Skip to content

Commit

Permalink
Fix shell and test262 driver bug
Browse files Browse the repository at this point in the history
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
  • Loading branch information
ksh8281 authored and clover2123 committed Jul 4, 2024
1 parent d59154a commit e2423b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
25 changes: 17 additions & 8 deletions src/shell/Shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ int main(int argc, char* argv[])
bool runShell = true;
bool seenModule = false;
std::string fileName;
int exitCode = 0;

for (int i = 1; i < argc; i++) {
if (strlen(argv[i]) >= 2 && argv[i][0] == '-') { // parse command line option
Expand Down Expand Up @@ -1097,8 +1098,11 @@ int main(int argc, char* argv[])
if (!clientSourceRef) {
break;
}
if (!evalScript(context, clientSourceRef, sourceName, false, false))
return 3;
if (!evalScript(context, clientSourceRef, sourceName, false, false)) {
runShell = false;
exitCode = 3;
break;
}
runShell = false;
}
continue;
Expand All @@ -1112,16 +1116,18 @@ int main(int argc, char* argv[])
runShell = false;
i++;
StringRef* src = StringRef::createFromUTF8(argv[i], strlen(argv[i]));
if (!evalScript(context, src, StringRef::createFromASCII("shell input"), false, false))
return 3;
if (!evalScript(context, src, StringRef::createFromASCII("shell input"), false, false)) {
runShell = false;
exitCode = 3;
break;
}
continue;
}
if (strcmp(argv[i], "-f") == 0) {
continue;
}
}
fprintf(stderr, "Cannot recognize option `%s`", argv[i]);
// return 3;
continue;
}

Expand All @@ -1141,7 +1147,9 @@ int main(int argc, char* argv[])
}

if (!evalScript(context, src, StringRef::createFromUTF8(fileName.data(), fileName.length()), false, seenModule)) {
return 3;
runShell = false;
exitCode = 3;
break;
}
seenModule = false;
fileName.clear();
Expand All @@ -1168,7 +1176,8 @@ int main(int argc, char* argv[])
printf("escargot> ");
if (!fgets(buf, sizeof buf, stdin)) {
printf("ERROR: Cannot read interactive shell input\n");
return 3;
exitCode = 3;
break;
}
StringRef* str = Escargot::StringRef::createFromUTF8(buf, strlen(buf));
evalScript(context, str, StringRef::emptyString(), true, false);
Expand Down Expand Up @@ -1207,5 +1216,5 @@ int main(int argc, char* argv[])
ProfilerStop();
#endif

return 0;
return exitCode;
}
2 changes: 0 additions & 2 deletions tools/test/test262/excludelist.orig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@
<test id="built-ins/AsyncFromSyncIteratorPrototype/return/return-null"><reason>TODO</reason></test>
<test id="built-ins/AsyncGeneratorPrototype/next/request-queue-await-order"><reason>TODO</reason></test>
<test id="built-ins/AsyncGeneratorPrototype/return/return-suspendedStart-broken-promise"><reason>TODO</reason></test>
<test id="built-ins/Atomics/waitAsync/bigint/good-views"><reason>TODO</reason></test>
<test id="built-ins/Atomics/waitAsync/good-views"><reason>TODO</reason></test>
<test id="built-ins/BigInt/constructor-coercion"><reason>TODO</reason></test>
<test id="built-ins/DataView/custom-proto-access-resizes-buffer-invalid-by-length"><reason>TODO</reason></test>
<test id="built-ins/DataView/custom-proto-access-resizes-buffer-invalid-by-offset"><reason>TODO</reason></test>
Expand Down
3 changes: 2 additions & 1 deletion tools/test/test262/test262.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ def GetDriverSource(self):
self.suite.GetInclude("cth.js") + \
self.suite.GetInclude("assert.js")

if self.IsAsyncTest():
# Escargot: some async test are does not returns True for self.IsAsyncTest()
if self.IsAsyncTest() or "Atomics" in self.GetFeatureList():
source = source + \
self.suite.GetInclude("timer.js") + \
self.suite.GetInclude("doneprintHandle.js").replace('print', self.suite.print_handle)
Expand Down

0 comments on commit e2423b2

Please sign in to comment.