Skip to content

Commit c7f2f14

Browse files
ochafikNeoZhangJianyu
authored andcommitted
json: attempt to skip slow tests when running under emulator (ggml-org#8189)
1 parent c54a069 commit c7f2f14

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ jobs:
799799
7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
800800
$sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
801801
cd build
802+
$env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
802803
& $sde -future -- ctest -L main -C Release --verbose --timeout 900
803804
804805
- name: Determine tag name

tests/test-json-schema-to-grammar.cpp

+22-18
Original file line numberDiff line numberDiff line change
@@ -1239,26 +1239,30 @@ int main() {
12391239
}
12401240
});
12411241

1242-
if (getenv("LLAMA_PYTHON_AVAILABLE") || (std::system("python -c \"import sys; exit(1) if sys.version_info < (3, 8) else print('Python version is sufficient')\"") == 0)) {
1243-
test_all("Python", [](const TestCase & tc) {
1244-
write("test-json-schema-input.tmp", tc.schema);
1245-
tc.verify_status(std::system(
1246-
"python ./examples/json_schema_to_grammar.py test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
1247-
tc.verify(read("test-grammar-output.tmp"));
1248-
});
1242+
if (getenv("LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR")) {
1243+
fprintf(stderr, "\033[33mWARNING: Skipping slow tests on emulator.\n\033[0m");
12491244
} else {
1250-
fprintf(stderr, "\033[33mWARNING: Python not found (min version required is 3.8), skipping Python JSON schema -> grammar tests.\n\033[0m");
1251-
}
1245+
if (getenv("LLAMA_PYTHON_AVAILABLE") || (std::system("python -c \"import sys; exit(1) if sys.version_info < (3, 8) else print('Python version is sufficient')\"") == 0)) {
1246+
test_all("Python", [](const TestCase & tc) {
1247+
write("test-json-schema-input.tmp", tc.schema);
1248+
tc.verify_status(std::system(
1249+
"python ./examples/json_schema_to_grammar.py test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
1250+
tc.verify(read("test-grammar-output.tmp"));
1251+
});
1252+
} else {
1253+
fprintf(stderr, "\033[33mWARNING: Python not found (min version required is 3.8), skipping Python JSON schema -> grammar tests.\n\033[0m");
1254+
}
12521255

1253-
if (getenv("LLAMA_NODE_AVAILABLE") || (std::system("node --version") == 0)) {
1254-
test_all("JavaScript", [](const TestCase & tc) {
1255-
write("test-json-schema-input.tmp", tc.schema);
1256-
tc.verify_status(std::system(
1257-
"node ./tests/run-json-schema-to-grammar.mjs test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
1258-
tc.verify(read("test-grammar-output.tmp"));
1259-
});
1260-
} else {
1261-
fprintf(stderr, "\033[33mWARNING: Node not found, skipping JavaScript JSON schema -> grammar tests.\n\033[0m");
1256+
if (getenv("LLAMA_NODE_AVAILABLE") || (std::system("node --version") == 0)) {
1257+
test_all("JavaScript", [](const TestCase & tc) {
1258+
write("test-json-schema-input.tmp", tc.schema);
1259+
tc.verify_status(std::system(
1260+
"node ./tests/run-json-schema-to-grammar.mjs test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
1261+
tc.verify(read("test-grammar-output.tmp"));
1262+
});
1263+
} else {
1264+
fprintf(stderr, "\033[33mWARNING: Node not found, skipping JavaScript JSON schema -> grammar tests.\n\033[0m");
1265+
}
12621266
}
12631267

12641268
test_all("Check Expectations Validity", [](const TestCase & tc) {

0 commit comments

Comments
 (0)