Skip to content

Commit

Permalink
Remove obsolete run-test262 style option
Browse files Browse the repository at this point in the history
We always run the test262 suite in new-style mode.
  • Loading branch information
bnoordhuis committed Oct 10, 2024
1 parent 3c3c487 commit 79eee54
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 128 deletions.
196 changes: 71 additions & 125 deletions run-test262.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ enum test_mode_t {
} test_mode = TEST_DEFAULT_NOSTRICT;
int skip_async;
int skip_module;
int new_style;
int dump_memory;
int stats_count;
JSMemoryUsage stats_all, stats_avg, stats_min, stats_max;
Expand Down Expand Up @@ -1130,10 +1129,6 @@ void load_config(const char *filename, const char *ignore)
printf("%s:%d: ignoring %s=%s\n", filename, lineno, p, q);
continue;
}
if (str_equal(p, "style")) {
new_style = str_equal(q, "new");
continue;
}
if (str_equal(p, "testdir")) {
char *testdir = compose_path(base_name, q);
enumerate_tests(testdir);
Expand Down Expand Up @@ -1754,136 +1749,90 @@ int run_test(const char *filename, int *msec)

harness = harness_dir;

if (new_style) {
if (!harness) {
p = strstr(filename, "test/");
if (p) {
snprintf(harnessbuf, sizeof(harnessbuf), "%.*s%s",
(int)(p - filename), filename, "harness");
}
harness = harnessbuf;
if (!harness) {
p = strstr(filename, "test/");
if (p) {
snprintf(harnessbuf, sizeof(harnessbuf), "%.*s%s",
(int)(p - filename), filename, "harness");
}
namelist_add(ip, NULL, "sta.js");
namelist_add(ip, NULL, "assert.js");
/* extract the YAML frontmatter */
desc = extract_desc(buf, '-');
if (desc) {
char *ifile, *option;
int state;
p = find_tag(desc, "includes:", &state);
if (p) {
while ((ifile = get_option(&p, &state)) != NULL) {
// skip unsupported harness files
if (find_word(harness_exclude, ifile)) {
skip |= 1;
} else {
namelist_add(ip, NULL, ifile);
}
free(ifile);
harness = harnessbuf;
}
namelist_add(ip, NULL, "sta.js");
namelist_add(ip, NULL, "assert.js");
/* extract the YAML frontmatter */
desc = extract_desc(buf, '-');
if (desc) {
char *ifile, *option;
int state;
p = find_tag(desc, "includes:", &state);
if (p) {
while ((ifile = get_option(&p, &state)) != NULL) {
// skip unsupported harness files
if (find_word(harness_exclude, ifile)) {
skip |= 1;
} else {
namelist_add(ip, NULL, ifile);
}
free(ifile);
}
p = find_tag(desc, "flags:", &state);
if (p) {
while ((option = get_option(&p, &state)) != NULL) {
if (str_equal(option, "noStrict") ||
str_equal(option, "raw")) {
is_nostrict = TRUE;
skip |= (test_mode == TEST_STRICT);
}
else if (str_equal(option, "onlyStrict")) {
is_onlystrict = TRUE;
skip |= (test_mode == TEST_NOSTRICT);
}
else if (str_equal(option, "async")) {
is_async = TRUE;
skip |= skip_async;
}
else if (str_equal(option, "module")) {
is_module = TRUE;
skip |= skip_module;
}
else if (str_equal(option, "CanBlockIsFalse")) {
can_block = FALSE;
}
free(option);
}
p = find_tag(desc, "flags:", &state);
if (p) {
while ((option = get_option(&p, &state)) != NULL) {
if (str_equal(option, "noStrict") ||
str_equal(option, "raw")) {
is_nostrict = TRUE;
skip |= (test_mode == TEST_STRICT);
}
}
p = find_tag(desc, "negative:", &state);
if (p) {
/* XXX: should extract the phase */
char *q = find_tag(p, "type:", &state);
if (q) {
while (isspace((unsigned char)*q))
q++;
error_type = strdup_len(q, strcspn(q, " \n"));
else if (str_equal(option, "onlyStrict")) {
is_onlystrict = TRUE;
skip |= (test_mode == TEST_NOSTRICT);
}
is_negative = TRUE;
}
p = find_tag(desc, "features:", &state);
if (p) {
while ((option = get_option(&p, &state)) != NULL) {
if (find_word(harness_features, option)) {
/* feature is enabled */
} else if (find_word(harness_skip_features, option)) {
/* skip disabled feature */
skip |= 1;
} else {
/* feature is not listed: skip and warn */
printf("%s:%d: unknown feature: %s\n", filename, 1, option);
skip |= 1;
}
free(option);
else if (str_equal(option, "async")) {
is_async = TRUE;
skip |= skip_async;
}
else if (str_equal(option, "module")) {
is_module = TRUE;
skip |= skip_module;
}
else if (str_equal(option, "CanBlockIsFalse")) {
can_block = FALSE;
}
free(option);
}
free(desc);
}
if (is_async)
namelist_add(ip, NULL, "doneprintHandle.js");
} else {
char *ifile;

if (!harness) {
p = strstr(filename, "test/");
if (p) {
snprintf(harnessbuf, sizeof(harnessbuf), "%.*s%s",
(int)(p - filename), filename, "test/harness");
}
harness = harnessbuf;
}

namelist_add(ip, NULL, "sta.js");

/* include extra harness files */
for (p = buf; (p = strstr(p, "$INCLUDE(\"")) != NULL; p++) {
p += 10;
ifile = strdup_len(p, strcspn(p, "\""));
// skip unsupported harness files
if (find_word(harness_exclude, ifile)) {
skip |= 1;
} else {
namelist_add(ip, NULL, ifile);
p = find_tag(desc, "negative:", &state);
if (p) {
/* XXX: should extract the phase */
char *q = find_tag(p, "type:", &state);
if (q) {
while (isspace((unsigned char)*q))
q++;
error_type = strdup_len(q, strcspn(q, " \n"));
}
free(ifile);
is_negative = TRUE;
}

/* locate the old style configuration comment */
desc = extract_desc(buf, '*');
if (desc) {
if (strstr(desc, "@noStrict")) {
is_nostrict = TRUE;
skip |= (test_mode == TEST_STRICT);
}
if (strstr(desc, "@onlyStrict")) {
is_onlystrict = TRUE;
skip |= (test_mode == TEST_NOSTRICT);
}
if (strstr(desc, "@negative")) {
/* XXX: should extract the regex to check error type */
is_negative = TRUE;
p = find_tag(desc, "features:", &state);
if (p) {
while ((option = get_option(&p, &state)) != NULL) {
if (find_word(harness_features, option)) {
/* feature is enabled */
} else if (find_word(harness_skip_features, option)) {
/* skip disabled feature */
skip |= 1;
} else {
/* feature is not listed: skip and warn */
printf("%s:%d: unknown feature: %s\n", filename, 1, option);
skip |= 1;
}
free(option);
}
free(desc);
}
free(desc);
}
if (is_async)
namelist_add(ip, NULL, "doneprintHandle.js");

use_strict = use_nostrict = 0;
/* XXX: should remove 'test_mode' or simplify it just to force
Expand Down Expand Up @@ -2086,7 +2035,6 @@ void help(void)
"-h help\n"
"-a run tests in strict and nostrict modes\n"
"-m print memory usage summary\n"
"-n use new style harness\n"
"-N run test prepared by test262-harness+eshost\n"
"-s run tests in strict mode, skip @nostrict tests\n"
"-E only run tests from the error file\n"
Expand Down Expand Up @@ -2159,8 +2107,6 @@ int main(int argc, char **argv)
help();
} else if (str_equal(arg, "-m")) {
dump_memory++;
} else if (str_equal(arg, "-n")) {
new_style++;
} else if (str_equal(arg, "-s")) {
test_mode = TEST_STRICT;
} else if (str_equal(arg, "-a")) {
Expand Down
3 changes: 0 additions & 3 deletions test262.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[config]
# general settings for test262 ES6 version

# framework style: old, new
style=new

# handle tests tagged as [noStrict]: yes, no, skip
nostrict=yes

Expand Down

0 comments on commit 79eee54

Please sign in to comment.