Spaces:
Sleeping
Sleeping
Commit
·
10e7682
1
Parent(s):
ba925f3
Fix
Browse files- execute.py +5 -5
execute.py
CHANGED
|
@@ -28,7 +28,7 @@ import subprocess
|
|
| 28 |
import tempfile
|
| 29 |
|
| 30 |
# https://github.com/THUDM/CodeGeeX/blob/ebeb850f227a90c79de39f7e26b1302f374f3240/codegeex/benchmark/rust/Cargo.toml
|
| 31 |
-
BASE_CARGO =
|
| 32 |
name = "rust"
|
| 33 |
version = "0.1.0"
|
| 34 |
edition = "2021"
|
|
@@ -38,8 +38,8 @@ edition = "2021"
|
|
| 38 |
[dependencies]
|
| 39 |
rand = "0.4"
|
| 40 |
regex = "1"
|
| 41 |
-
md5 = "0.7.0
|
| 42 |
-
|
| 43 |
|
| 44 |
|
| 45 |
def check_correctness(check_program, timeout, task_id, completion_id, language):
|
|
@@ -273,9 +273,9 @@ def unsafe_execute_rust(check_program, result, timeout):
|
|
| 273 |
# Proceed towards Rust binaries compilation. Therefore move to Rust module root dir.
|
| 274 |
os.chdir(RUST_DIR)
|
| 275 |
|
| 276 |
-
compilation_result = subprocess.run(["cargo", "check", "--bin", "test", "--message-format", "json"], capture_output=True)
|
| 277 |
if compilation_result.returncode == 0:
|
| 278 |
-
exec_result = subprocess.run(["cargo", "test", "--bin", "test", "--message-format", "json"], capture_output=True)
|
| 279 |
if exec_result.returncode == 0:
|
| 280 |
result.append("passed")
|
| 281 |
else:
|
|
|
|
| 28 |
import tempfile
|
| 29 |
|
| 30 |
# https://github.com/THUDM/CodeGeeX/blob/ebeb850f227a90c79de39f7e26b1302f374f3240/codegeex/benchmark/rust/Cargo.toml
|
| 31 |
+
BASE_CARGO = '''[package]
|
| 32 |
name = "rust"
|
| 33 |
version = "0.1.0"
|
| 34 |
edition = "2021"
|
|
|
|
| 38 |
[dependencies]
|
| 39 |
rand = "0.4"
|
| 40 |
regex = "1"
|
| 41 |
+
md5 = "0.7.0"
|
| 42 |
+
'''
|
| 43 |
|
| 44 |
|
| 45 |
def check_correctness(check_program, timeout, task_id, completion_id, language):
|
|
|
|
| 273 |
# Proceed towards Rust binaries compilation. Therefore move to Rust module root dir.
|
| 274 |
os.chdir(RUST_DIR)
|
| 275 |
|
| 276 |
+
compilation_result = subprocess.run(["cargo", "check", "--bin", "test", "--message-format", "json"], timeout=timeout, capture_output=True)
|
| 277 |
if compilation_result.returncode == 0:
|
| 278 |
+
exec_result = subprocess.run(["cargo", "test", "--bin", "test", "--message-format", "json"], timeout=timeout, capture_output=True)
|
| 279 |
if exec_result.returncode == 0:
|
| 280 |
result.append("passed")
|
| 281 |
else:
|