@@ -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