Ignore:
Timestamp:
Sep 2, 2016, 5:12:16 PM (9 years ago)
Author:
[email protected]
Message:

Import Chakra tests to JSC
https://bugs.webkit.org/show_bug.cgi?id=154697

Reviewed by Saam Barati.

Added Chakra tests. All these tests are under Chakra/test. This is the same layout
for tests in the Chakra tree.

Created a ChakraCore.yaml file to be used with run-jsc-stress-tests. This file contains
the tests that are run when the original Chakra runtests.py script is run. That script
is the test driver for *nix platforms and does not attempt to run all tests or all
variations of tests. The runtest.py driver consults rlexe.xml files in each test
subdirectory to determine the test to run, the options to pass to the test and how to
determine pass/fail of the test. With runtests.py as the start, tests that didn't
pass directly where either skipped, with a message describing why or through
adjustments to the test infrastructure, as described below, where made to pass.

The only modification to the test infrastrucutre are:

1) Added simple mapping of Chakra expected exception text to JSC expected text in

test/UnitTestFramework/UnitTestFramework.js. It would make sense to also
map some JSC specific exception text to more generic text for the cases where
that text contains indetifier names or other source specific strings and the
Chakra equivolent exception texts are generic.

2) Created JSC specific expected text files where it is clear that the text work

as expected on JSC but the test output is different. Typically the differences
fall into three categories, different exception output, different output from
toString() of a function, slight numeric differences, and test that rely on
iteration order.

3) Stripped the CR's from the CR-LF line terminations of the files.

No actual test .js files were modified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r205372 r205387  
    700700    String m_profilerOutput;
    701701    String m_uncaughtExceptionName;
     702    bool m_alwaysDumpUncaughtException { false };
    702703    bool m_dumpSamplingProfilerData { false };
    703704
     
    21092110}
    21102111
    2111 static bool checkUncaughtException(VM& vm, GlobalObject* globalObject, JSValue exception, const String& expectedExceptionName)
     2112static bool checkUncaughtException(VM& vm, GlobalObject* globalObject, JSValue exception, const String& expectedExceptionName, bool alwaysDumpException)
    21122113{
    21132114    vm.clearException();
     
    21292130        return false;
    21302131    }
    2131     if (isInstanceOfExpectedException)
     2132    if (isInstanceOfExpectedException) {
     2133        if (alwaysDumpException)
     2134            dumpException(globalObject, exception);
    21322135        return true;
     2136    }
    21332137
    21342138    printf("Expected uncaught exception with name '%s' but exception value is not instance of this exception class\n", expectedExceptionName.utf8().data());
     
    21372141}
    21382142
    2139 static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scripts, const String& uncaughtExceptionName, bool dump, bool module)
     2143static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scripts, const String& uncaughtExceptionName, bool alwaysDumpUncaughtException, bool dump, bool module)
    21402144{
    21412145    String fileName;
     
    21562160                dumpException(globalObject, value);
    21572161        } else
    2158             success = success && checkUncaughtException(vm, globalObject, (hasException) ? value : JSValue(), uncaughtExceptionName);
     2162            success = success && checkUncaughtException(vm, globalObject, (hasException) ? value : JSValue(), uncaughtExceptionName, alwaysDumpUncaughtException);
    21592163    };
    21602164
     
    23002304    fprintf(stderr, "  --module-file=<file>       Parse and evaluate the given file as module (this option may be passed more than once)\n");
    23012305    fprintf(stderr, "  --exception=<name>         Check the last script exits with an uncaught exception with the specified name\n");
     2306    fprintf(stderr, "  --dumpException            Dump uncaught exception text\n");
    23022307    fprintf(stderr, "  --options                  Dumps all JSC VM options and exits\n");
    23032308    fprintf(stderr, "  --dumpOptions              Dumps all non-default JSC VM options before continuing\n");
     
    24032408        }
    24042409
     2410        if (!strcmp(arg, "--dumpException")) {
     2411            m_alwaysDumpUncaughtException = true;
     2412            continue;
     2413        }
     2414
    24052415        static const unsigned exceptionStrLength = strlen("--exception=");
    24062416        if (!strncmp(arg, "--exception=", exceptionStrLength)) {
     
    24532463
    24542464    GlobalObject* globalObject = GlobalObject::create(*vm, GlobalObject::createStructure(*vm, jsNull()), options.m_arguments);
    2455     bool success = runWithScripts(globalObject, options.m_scripts, options.m_uncaughtExceptionName, options.m_dump, options.m_module);
     2465    bool success = runWithScripts(globalObject, options.m_scripts, options.m_uncaughtExceptionName, options.m_alwaysDumpUncaughtException, options.m_dump, options.m_module);
    24562466    if (options.m_interactive && success)
    24572467        runInteractive(globalObject);
Note: See TracChangeset for help on using the changeset viewer.