Skip to content

Commit e78fd63

Browse files
committed
fix(xtask/eval): Resolve compilation warnings
1 parent 3444f6c commit e78fd63

File tree

4 files changed

+353
-79
lines changed

4 files changed

+353
-79
lines changed

eval_result.json

Lines changed: 157 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,178 @@
11
{
22
"exercises": [
33
{
4-
"name": "f16_overflow.rs",
5-
"result": false
4+
"name": "exercise00",
5+
"result": true
6+
},
7+
{
8+
"name": "exercise01",
9+
"result": true
10+
},
11+
{
12+
"name": "exercise02",
13+
"result": true
14+
},
15+
{
16+
"name": "exercise03",
17+
"result": true
18+
},
19+
{
20+
"name": "exercise04",
21+
"result": true
22+
},
23+
{
24+
"name": "exercise05",
25+
"result": true
26+
},
27+
{
28+
"name": "exercise06",
29+
"result": true
30+
},
31+
{
32+
"name": "exercise07",
33+
"result": true
34+
},
35+
{
36+
"name": "exercise08",
37+
"result": true
38+
},
39+
{
40+
"name": "exercise09",
41+
"result": true
642
},
743
{
8-
"name": "f16_basics.rs",
9-
"result": false
44+
"name": "exercise10",
45+
"result": true
46+
},
47+
{
48+
"name": "exercise11",
49+
"result": true
50+
},
51+
{
52+
"name": "exercise12",
53+
"result": true
54+
},
55+
{
56+
"name": "exercise13",
57+
"result": true
58+
},
59+
{
60+
"name": "exercise14",
61+
"result": true
62+
},
63+
{
64+
"name": "exercise15",
65+
"result": true
66+
},
67+
{
68+
"name": "exercise16",
69+
"result": true
70+
},
71+
{
72+
"name": "exercise17",
73+
"result": true
74+
},
75+
{
76+
"name": "exercise18",
77+
"result": true
78+
},
79+
{
80+
"name": "exercise19",
81+
"result": true
1082
},
1183
{
12-
"name": "attention_score.rs",
84+
"name": "exercise20",
1385
"result": true
1486
},
1587
{
16-
"name": "gradient_compute.rs",
88+
"name": "exercise21",
1789
"result": true
1890
},
1991
{
20-
"name": "layer_norm.rs",
21-
"result": false
92+
"name": "exercise22",
93+
"result": true
94+
},
95+
{
96+
"name": "exercise23",
97+
"result": true
98+
},
99+
{
100+
"name": "exercise24",
101+
"result": true
102+
},
103+
{
104+
"name": "exercise25",
105+
"result": true
106+
},
107+
{
108+
"name": "exercise26",
109+
"result": true
110+
},
111+
{
112+
"name": "exercise27",
113+
"result": true
114+
},
115+
{
116+
"name": "exercise28",
117+
"result": true
118+
},
119+
{
120+
"name": "exercise29",
121+
"result": true
122+
},
123+
{
124+
"name": "exercise30",
125+
"result": true
126+
},
127+
{
128+
"name": "exercise31",
129+
"result": true
130+
},
131+
{
132+
"name": "exercise32",
133+
"result": true
134+
},
135+
{
136+
"name": "exercise33",
137+
"result": true
138+
},
139+
{
140+
"name": "exercise34",
141+
"result": true
142+
},
143+
{
144+
"name": "exercise35",
145+
"result": true
146+
},
147+
{
148+
"name": "exercise36",
149+
"result": true
150+
},
151+
{
152+
"name": "exercise37",
153+
"result": true
154+
},
155+
{
156+
"name": "exercise38",
157+
"result": true
158+
},
159+
{
160+
"name": "exercise39",
161+
"result": true
162+
},
163+
{
164+
"name": "exercise40",
165+
"result": true
22166
},
23167
{
24-
"name": "multi_head_attention.rs",
168+
"name": "exercise41",
25169
"result": true
26170
}
27171
],
28172
"statistics": {
29-
"total_exercations": 6,
30-
"total_succeeds": 3,
31-
"total_failures": 3,
32-
"total_time": 2
173+
"total_exercations": 42,
174+
"total_succeeds": 42,
175+
"total_failures": 0,
176+
"total_time": 17
33177
}
34178
}

report/index.html

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>训练营项目报告</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<nav>
11+
<div class="logo">训练营项目</div>
12+
<ul>
13+
<li><a href="#usage">使用说明</a></li>
14+
<li><a href="#extension">扩展指南</a></li>
15+
<li><a href="#features">技术特点</a></li>
16+
</ul>
17+
</nav>
18+
<header>
19+
<h1>训练营项目产品手册</h1>
20+
<p>一个用于管理和评测编程练习的基于Rust的工具</p>
21+
</header>
22+
<main>
23+
<section id="usage">
24+
<h2><span class="icon">🚀</span> 产品使用说明</h2>
25+
<p>本工具提供了一套命令行接口,用于管理和评测不同课程的练习。</p>
26+
<h3>配置新课程</h3>
27+
<p>使用 <code>learn</code> 命令来克隆和配置一个新的课程仓库作为 git submodule。</p>
28+
<pre><code>cargo xtask learn --course &lt;课程名称&gt; --submodule &lt;课程仓库Git地址&gt;</code></pre>
29+
<p>例如,要配置一个名为 `my-rust-course` 的课程,可以运行:</p>
30+
<pre><code>cargo xtask learn --course my-rust-course --submodule https://github.com/user/my-rust-course.git</code></pre>
31+
32+
<h3>评测练习</h3>
33+
<p>使用 <code>eval</code> 命令来评测练习。可以评测所有课程,也可以指定单个课程。</p>
34+
<p>评测所有课程:</p>
35+
<pre><code>cargo xtask eval</code></pre>
36+
<p>评测指定课程:</p>
37+
<pre><code>cargo xtask eval --course &lt;课程名称&gt;</code></pre>
38+
<p>评测结果将显示在终端,并保存到项目根目录下的 <code>eval_result.json</code> 文件中。</p>
39+
</section>
40+
41+
<section id="extension">
42+
<h2><span class="icon">🧩</span> 如何拓展新课程评测</h2>
43+
<p>系统可以方便地扩展以支持新的课程类型。目前的实现支持 `learning-lm-rs`、`learning-cxx` 和其他基于 `rustlings` 的课程。</p>
44+
<p>要添加对新课程类型的支持,需要修改 <code>xtask/src/eval.rs</code> 文件:</p>
45+
<ol>
46+
<li><code>eval.rs</code> 中为你的新课程类型添加一个新的评测函数,例如 <code>eval_my_course(&self, course_path: &Path) -> Result&lt;(...)&gt;</code></li>
47+
<li>
48+
<code>run_eval</code> 函数的 <code>match</code> 语句中,添加一个新的分支来调用你的评测函数。
49+
<pre><code>// in xtask/src/eval.rs, inside run_eval function
50+
let (results, succeeds, failures, exercations) = match course_name {
51+
"learning-lm-rs" => self.eval_learning_lm(&path)?,
52+
"learning-cxx" => self.eval_learning_cxx(&path)?,
53+
"my-new-course" => self.eval_my_course(&path)?, // 添加新的分支
54+
_ => self.eval_rustlings(&path)?
55+
};</code></pre>
56+
</li>
57+
</ol>
58+
<p>新的评测函数需要实现具体的评测逻辑,例如运行测试、检查输出来确定练习的通过状态,并返回一个包含练习结果、成功数、失败数和总数的元组。</p>
59+
</section>
60+
61+
<section id="features">
62+
<h2><span class="icon">💡</span> 技术特点</h2>
63+
<ul>
64+
<li><strong>基于 Rust 构建:</strong> 核心工具链使用 Rust 编写,确保了高性能和内存安全。</li>
65+
<li><strong>可扩展的评测引擎:</strong> 通过模块化的设计,可以轻松地为不同语言或框架的课程添加新的评测逻辑。</li>
66+
<li><strong>命令行接口:</strong> 使用 <code>clap</code> 库提供清晰、易用的命令行接口。</li>
67+
<li><strong>Git Submodule 集成:</strong> 课程作为 Git 子模块进行管理,方便版本控制和分发。</li>
68+
<li><strong>结构化输出:</strong> 评测结果以 JSON 格式输出,方便与其他工具或系统集成。</li>
69+
</ul>
70+
</section>
71+
</main>
72+
<footer>
73+
<p>报告生成于 &copy; 2025</p>
74+
</footer>
75+
</body>
76+
</html>

report/style.css

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
body {
2+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
3+
line-height: 1.8;
4+
margin: 0;
5+
padding: 0;
6+
background-color: #f8f9fa;
7+
color: #343a40;
8+
}
9+
10+
nav {
11+
background: #ffffff;
12+
color: #333;
13+
padding: 0 2rem;
14+
display: flex;
15+
justify-content: space-between;
16+
align-items: center;
17+
border-bottom: 1px solid #e9ecef;
18+
position: sticky;
19+
top: 0;
20+
z-index: 1000;
21+
}
22+
23+
nav .logo {
24+
font-size: 1.5rem;
25+
font-weight: bold;
26+
}
27+
28+
nav ul {
29+
list-style: none;
30+
margin: 0;
31+
padding: 0;
32+
display: flex;
33+
}
34+
35+
nav ul li a {
36+
display: block;
37+
padding: 1.5rem 1rem;
38+
text-decoration: none;
39+
color: #555;
40+
transition: background-color 0.3s, color 0.3s;
41+
}
42+
43+
nav ul li a:hover {
44+
background-color: #f1f1f1;
45+
color: #000;
46+
}
47+
48+
header {
49+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
50+
color: #fff;
51+
padding: 4rem 2rem;
52+
text-align: center;
53+
}
54+
55+
header h1 {
56+
font-size: 3rem;
57+
margin: 0;
58+
}
59+
60+
header p {
61+
font-size: 1.2rem;
62+
opacity: 0.9;
63+
}
64+
65+
main {
66+
padding: 2rem;
67+
margin: 2rem auto;
68+
max-width: 900px;
69+
background: #ffffff;
70+
border-radius: 8px;
71+
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
72+
}
73+
74+
section {
75+
margin-bottom: 3rem;
76+
padding: 2rem;
77+
border-bottom: 1px solid #eee;
78+
}
79+
80+
section:last-child {
81+
border-bottom: none;
82+
}
83+
84+
h2 {
85+
font-size: 2rem;
86+
color: #333;
87+
display: flex;
88+
align-items: center;
89+
}
90+
91+
h2 .icon {
92+
margin-right: 1rem;
93+
font-size: 2.5rem;
94+
}
95+
96+
pre {
97+
background: #2d2d2d;
98+
color: #f8f8f2;
99+
padding: 1.5rem;
100+
border-radius: 8px;
101+
white-space: pre-wrap;
102+
word-wrap: break-word;
103+
font-size: 0.95rem;
104+
position: relative;
105+
}
106+
107+
code {
108+
font-family: 'Fira Code', 'Courier New', Courier, monospace;
109+
}
110+
111+
footer {
112+
text-align: center;
113+
padding: 1rem 0;
114+
margin-top: 2rem;
115+
font-size: 0.9rem;
116+
color: #666;
117+
}

0 commit comments

Comments
 (0)