static __attribute__((__format__(__printf__, 1, 2))) void print_error(const char *fmt, ...)
{
- char buf[1024];
va_list ap;
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
if (update_errors) {
+ char buf[256], *str;
+ int len;
+
+ va_start(ap, fmt);
+ len = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ if (len >= sizeof(buf)) {
+ str = malloc(len + 1);
+ va_start(ap, fmt);
+ vsnprintf(str, len + 1, fmt, ap);
+ va_end(ap);
+ } else {
+ str = buf;
+ }
pthread_mutex_lock(&error_list_mutex);
- namelist_add(&error_list, NULL, buf);
+ namelist_add(&error_list, NULL, str);
pthread_mutex_unlock(&error_list_mutex);
+ if (str != buf)
+ free(str);
} else {
- fputs(buf, stdout);
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
}
}
js_agent_free(ctx);
JS_FreeContext(ctx);
JS_FreeRuntime(rt);
-
- atomic_inc(&test_count);
- if (ret) {
- atomic_inc(&test_failed);
- if (outfile) {
- /* do not output a failure number to minimize diff */
- fprintf(outfile, " FAILED\n");
- }
- }
return ret;
}
error_type, eval_flags, is_negative, is_async,
can_block);
}
- if (use_strict) {
+ /* we avoid running the strict mode test if there was an error
+ in the nostrict case to have a single error report per
+ test */
+ if (use_strict && ret == 0) {
ret |= run_test_buf(tls, filename, harness, ip, buf, buf_len,
error_type, eval_flags | JS_EVAL_FLAG_STRICT,
is_negative, is_async, can_block);
}
clocks = clock() - clocks;
+
+ atomic_inc(&test_count);
+ if (ret) {
+ atomic_inc(&test_failed);
+ if (outfile) {
+ /* do not output a failure number to minimize diff */
+ fprintf(outfile, " FAILED\n");
+ }
+ }
+
if (outfile && index >= 0 && clocks >= CLOCKS_PER_SEC / 10) {
/* output timings for tests that take more than 100 ms */
fprintf(outfile, " time: %d ms\n", (int)(clocks * 1000LL / CLOCKS_PER_SEC));
"-s run tests in strict mode, skip @nostrict tests\n"
"-E only run tests from the error file\n"
"-C use compact progress indicator\n"
+ "-q no progress indicator\n"
"-t show timings\n"
"-u update error file\n"
"-v verbose: output error messages\n"
BOOL is_module = FALSE;
BOOL can_block = TRUE;
BOOL count_skipped_features = FALSE;
+ int enable_progress = -1;
clock_t clocks;
init_thread_local_storage(tls);
pthread_mutex_init(&error_list_mutex, NULL);
#if !defined(_WIN32)
- compact = !isatty(STDERR_FILENO);
/* Date tests assume California local time */
setenv("TZ", "America/Los_Angeles", 1);
#endif
} else if (str_equal(arg, "-v")) {
verbose++;
} else if (str_equal(arg, "-C")) {
+ enable_progress = 1;
compact = 1;
+ } else if (str_equal(arg, "-q")) {
+ enable_progress = 0;
} else if (str_equal(arg, "-c")) {
load_config(get_opt_arg(arg, argv[optind++]), ignore);
} else if (str_equal(arg, "-d")) {
update_exclude_dirs();
+ if (enable_progress < 0) {
+#if defined(_WIN32)
+ enable_progress = 1;
+#else
+ enable_progress = (isatty(STDERR_FILENO) != 0);
+#endif
+ }
+
clocks = clock();
if (count_skipped_features) {
pthread_cond_init(&progress_cond, NULL);
pthread_mutex_init(&progress_mutex, NULL);
- pthread_create(&progress_thread, NULL, show_progress, NULL);
-
+ if (enable_progress) {
+ pthread_create(&progress_thread, NULL, show_progress, NULL);
+ }
+
threads = malloc(sizeof(threads[0]) * nthreads);
for (i = 0; i < nthreads; i++) {
RunTestDirThread *th = &threads[i];
pthread_join(threads[i].tid, NULL);
free(threads);
- pthread_mutex_lock(&progress_mutex);
- progress_exit_request = TRUE;
- pthread_cond_signal(&progress_cond);
- pthread_mutex_unlock(&progress_mutex);
- pthread_join(progress_thread, NULL);
-
+ if (enable_progress) {
+ pthread_mutex_lock(&progress_mutex);
+ progress_exit_request = TRUE;
+ pthread_cond_signal(&progress_cond);
+ pthread_mutex_unlock(&progress_mutex);
+ pthread_join(progress_thread, NULL);
+ }
pthread_mutex_destroy(&progress_mutex);
pthread_cond_destroy(&progress_cond);
fclose(outfile);
outfile = NULL;
}
+ /* useful to have the report at the end in case stdout and
+ stderr are redirected to a single file */
+ fflush(stdout);
} else {
outfile = stdout;
while (optind < argc) {
free(error_file);
/* Signal that the error file is out of date. */
- return new_errors || changed_errors || fixed_errors;
+ if (update_errors) {
+ return 0;
+ } else {
+ return new_errors || changed_errors || fixed_errors;
+ }
}
test262/test/annexB/language/expressions/assignmenttargettype/callexpression.js:33: SyntaxError: invalid assignment left-hand side
test262/test/annexB/language/expressions/assignmenttargettype/cover-callexpression-and-asyncarrowhead.js:20: SyntaxError: invalid assignment left-hand side
test262/test/built-ins/Promise/try/avoids-wrap-for-subclass.js:10: Test262Error: Expected SameValue(«[object Promise]», «[object Promise]») to be true
-test262/test/built-ins/Promise/try/avoids-wrap-for-subclass.js:10: strict mode: Test262Error: Expected SameValue(«[object Promise]», «[object Promise]») to be true
test262/test/built-ins/Promise/try/avoids-wrap.js:10: Test262Error: Expected SameValue(«[object Promise]», «[object Promise]») to be true
-test262/test/built-ins/Promise/try/avoids-wrap.js:10: strict mode: Test262Error: Expected SameValue(«[object Promise]», «[object Promise]») to be true
test262/test/language/expressions/assignment/S11.13.1_A6_T1.js:23: Test262Error: #1: innerX === undefined. Actual: 1
test262/test/language/expressions/assignment/S11.13.1_A6_T2.js:23: Test262Error: #1: innerX === 2. Actual: 1
test262/test/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js:24: Test262Error: #1: innerX === 2. Actual: 12
test262/test/language/module-code/namespace/internals/super-access-to-tdz-binding.js:32: Test262Error: Expected a ReferenceError but got a TypeError
test262/test/staging/sm/Function/arguments-parameter-shadowing.js:14: Test262Error: Expected SameValue(«true», «false») to be true
test262/test/staging/sm/Function/constructor-binding.js:11: Test262Error: Expected SameValue(«"function"», «"undefined"») to be true
-test262/test/staging/sm/Function/constructor-binding.js:11: strict mode: Test262Error: Expected SameValue(«"function"», «"undefined"») to be true
test262/test/staging/sm/Function/function-bind.js:24: Test262Error: Conforms to NativeFunction Syntax: "function bound unbound() {\n [native code]\n}"
test262/test/staging/sm/Function/function-name-for.js:13: Test262Error: Expected SameValue(«""», «"forInHead"») to be true
test262/test/staging/sm/Function/implicit-this-in-parameter-expression.js:12: Test262Error: Expected SameValue(«[object Object]», «undefined») to be true
test262/test/staging/sm/Function/invalid-parameter-list.js:13: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all
-test262/test/staging/sm/Function/invalid-parameter-list.js:13: strict mode: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all
test262/test/staging/sm/async-functions/async-contains-unicode-escape.js:11: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all
-test262/test/staging/sm/async-functions/async-contains-unicode-escape.js:11: strict mode: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all
test262/test/staging/sm/async-functions/await-in-arrow-parameters.js:10: Test262Error: AsyncFunction:(a = (b = await/r/g) => {}) => {} Expected a SyntaxError to be thrown but no exception was thrown at all
-test262/test/staging/sm/async-functions/await-in-arrow-parameters.js:10: strict mode: Test262Error: AsyncFunction:(a = (b = await/r/g) => {}) => {} Expected a SyntaxError to be thrown but no exception was thrown at all
test262/test/staging/sm/class/boundFunctionSubclassing.js:9: Test262Error: Expected SameValue(«false», «true») to be true
-test262/test/staging/sm/class/boundFunctionSubclassing.js:9: strict mode: Test262Error: Expected SameValue(«false», «true») to be true
test262/test/staging/sm/class/strictExecution.js:13: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
test262/test/staging/sm/class/superPropOrdering.js:17: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
-test262/test/staging/sm/class/superPropOrdering.js:17: strict mode: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
test262/test/staging/sm/generators/syntax.js:50: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all
test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-arguments.js:13: Test262Error: Expected SameValue(«"object"», «"function"») to be true
test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-eval.js:11: Test262Error: Expected SameValue(«"outer-gouter-geval-gtruefalseq"», «"outer-geval-gwith-gtruefalseq"») to be true
test262/test/staging/sm/lexical-environment/block-scoped-functions-deprecated-redecl.js:23: Test262Error: Expected SameValue(«3», «4») to be true
test262/test/staging/sm/lexical-environment/var-in-catch-body-annex-b-eval.js:16: Test262Error: Expected SameValue(«"g"», «"global-x"») to be true
test262/test/staging/sm/object/defineProperties-order.js:11: Test262Error: Expected SameValue(«"ownKeys,getOwnPropertyDescriptor,getOwnPropertyDescriptor,get,get"», «"ownKeys,getOwnPropertyDescriptor,get,getOwnPropertyDescriptor,get"») to be true
-test262/test/staging/sm/object/defineProperties-order.js:11: strict mode: Test262Error: Expected SameValue(«"ownKeys,getOwnPropertyDescriptor,getOwnPropertyDescriptor,get,get"», «"ownKeys,getOwnPropertyDescriptor,get,getOwnPropertyDescriptor,get"») to be true
test262/test/staging/sm/regress/regress-602621.js:13: Test262Error: function sub-statement must override arguments Expected SameValue(«"function"», «"object"») to be true
test262/test/staging/sm/regress/regress-1383630.js:28: Test262Error: proxy must report the same value for the non-writable, non-configurable property Expected a TypeError to be thrown but no exception was thrown at all
-test262/test/staging/sm/regress/regress-1383630.js:28: strict mode: Test262Error: proxy must report the same value for the non-writable, non-configurable property Expected a TypeError to be thrown but no exception was thrown at all
test262/test/staging/sm/statements/arrow-function-in-for-statement-head.js:13: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all
-test262/test/staging/sm/statements/arrow-function-in-for-statement-head.js:13: strict mode: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all
test262/test/staging/sm/statements/try-completion.js:11: Test262Error: Expected SameValue(«"try"», «undefined») to be true
-test262/test/staging/sm/statements/try-completion.js:11: strict mode: Test262Error: Expected SameValue(«"try"», «undefined») to be true