Skip to content

Commit a5a7850

Browse files
committed
Add dir exclude override to run-test262.c
Allows including test/staging/explicit-resource-management while still excluding everything else from test/staging in test262.conf. Example: [exclude] test/staging/ !test/staging/explicit-resource-management/
1 parent e1b5978 commit a5a7850

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

run-test262.c

+13-8
Original file line numberDiff line numberDiff line change
@@ -1062,8 +1062,9 @@ void update_exclude_dirs(void)
10621062
namelist_t *lp = &test_list;
10631063
namelist_t *ep = &exclude_list;
10641064
namelist_t *dp = &exclude_dir_list;
1065-
char *name;
1065+
char *name, *path;
10661066
int i, j, count;
1067+
size_t include, exclude;
10671068

10681069
/* split directpries from exclude_list */
10691070
for (count = i = 0; i < ep->count; i++) {
@@ -1082,15 +1083,19 @@ void update_exclude_dirs(void)
10821083
/* filter out excluded directories */
10831084
for (count = i = 0; i < lp->count; i++) {
10841085
name = lp->array[i];
1086+
include = exclude = 0;
10851087
for (j = 0; j < dp->count; j++) {
1086-
if (has_prefix(name, dp->array[j])) {
1087-
test_excluded++;
1088-
free(name);
1089-
name = NULL;
1090-
break;
1091-
}
1088+
path = dp->array[j];
1089+
if (has_prefix(name, path))
1090+
exclude = strlen(path);
1091+
if (*path == '!' && has_prefix(name, &path[1]))
1092+
include = strlen(&path[1]);
10921093
}
1093-
if (name) {
1094+
// most specific include/exclude wins
1095+
if (exclude > include) {
1096+
test_excluded++;
1097+
free(name);
1098+
} else {
10941099
lp->array[count++] = name;
10951100
}
10961101
}

0 commit comments

Comments
 (0)