summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibTest
AgeCommit message (Collapse)Author
2021-11-01Everywhere: Remove unused ArgsParser headerBen Wiederhake
Found while trying to enumerate all programs that use ArgsParser.
2021-10-29LibJS: Convert JSONObject functions to ThrowCompletionOrIdan Horowitz
2021-10-24LibTest: Introduce a macro to only compare truthinessTim Schumacher
2021-10-24LibJS: Include executable name in bytecode dumpsAndreas Kling
2021-10-24LibJS: Move global "should dump bytecode" flag into LibJSAndreas Kling
This will allow us to trigger bytecode executable dumps when generating bytecode inside LibJS as well, not just in clients like js and test-js.
2021-10-24LibJS: Add Bytecode::Executable::dump()Andreas Kling
Let's have a helper for producing a consistent executable dump instead of repeating the logic in multiple places.
2021-10-20LibJS: Convert test-js/test-web/test-wasm to ThrowCompletionOrIdan Horowitz
2021-10-20LibJS: Rename define_native_function => define_old_native_functionIdan Horowitz
This method will eventually be removed once all native functions are converted to ThrowCompletionOr
2021-10-20LibJS: Add ThrowCompletionOr versions of the JS native function macrosIdan Horowitz
The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all native functions were converted to the new format.
2021-10-03LibJS: Convert Object::get() to ThrowCompletionOrLinus Groh
To no one's surprise, this patch is pretty big - this is possibly the most used AO of all of them. Definitely worth it though.
2021-10-02LibJS: Put zombie cell tracking code behind a compile-time flagAndreas Kling
Since this is a debug-only feature, let's not have it impact GC marking performance when you don't need it.
2021-09-30LibJS + test-js: Get results from the global object directlydavidot
This is as the spec would require you to do it and necessary for changes to come in the following commits.
2021-09-14LibJS+LibTest: Use JS::Script and JS::SourceTextModule in test-jsAndreas Kling
Instead of creating a Parser and Lexer manually in test-js, we now use either JS::Script::parse() or JS::SourceTextModule::parse() to load tests.
2021-09-14LibTest: Decorate cleanup_and_exit() with [[noreturn]]Andreas Kling
2021-09-12LibJS: Allocate a Realm next to GlobalObject in Interpreter::create()Linus Groh
Also pass a Realm reference to the Bytecode::Interpreter constructor, just like we pass the GlobalObject.
2021-09-11LibJS+js+test-js: Add GC debug mode that keeps cells "alive" as zombiesAndreas Kling
This patch adds a `-z` option to js and test-js. When run in this mode, garbage cells are never actually destroyed. We instead keep them around in a special zombie state. This allows us to validate that zombies don't get marked in future GC scans (since there were not supposed to be any more references!) :^) Cells get notified when they become a zombie (via did_become_zombie()) and this is used by WeakContainer cells to deregister themselves from the heap.
2021-08-31LibTest: Add TEST_SETUP macro that runs before all test casesPeter Elliott
2021-08-19LibTest+Utilities: Print a start message before each test in run-testsAndrew Kaster
It can sometimes be difficult to tell from the debug.log and test stdout which test was the last to run before the test runner hangs or exits the QEMU instance unexpectedly. Print out a start message before each test is executed, along with a progress message indicating which test out of how many tests we're about to run.
2021-08-15LibJS: Add a mode to parse JS as a moduledavidot
In a module strict mode should be enabled at the start of parsing and we allow import and export statements.
2021-08-12LibELF+LibTest: Fix incorrect #ifdefGunnar Beutner
2021-08-12LibTest: Emit a profile signpost at the start of each testAndreas Kling
This makes it super easy to see which test is which when browsing a profile of the test runner. :^)
2021-07-29Meta/LibTest: Build object libraries for test main filesAndrew Kaster
By using the power of object libraries and $<TARGET_OBJECTS> we can make sure to only build TestMain.cpp and JavaScriptTestRunnerMain.cpp once. Previously we built these cpp files into object files once for every single test executable. This change reduces the number of total compile jobs in a Serenity target build by around 100.
2021-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19LibTest/Utilities: Add method for TestRunner to print failed test namesAndrew Kaster
If a test run has a lot of tests in it, and they fill up the terminal buffer, it can be difficult to find out exactly which tests have failed from your large test run. Make TestRunner print out an optional Vector of failed test names at the end of the run, and have run-tests add each failed or crashed test to a Vector it uses for this purpose.
2021-07-06LibTest: Clear core dump flag for CrashTest child processesAndrew Kaster
Because these processes are expected to crash, generating a core dump from them and throwing up a CrashReporter window is less helpful than it is distracting while running many tests at a time. Use the prctl for controlling the core dump-able flag to tell the kernel we don't want core dumps from these processes. Note that because we also build LibTest for Lagom, we have to check for MacOS which doesn't support prctl(PR_SET_DUMPABLE).
2021-07-06LibJS: Add define_direct_property and remove the define_property helperIdan Horowitz
This removes all usages of the non-standard define_property helper method and replaces all it's usages with the specification required alternative or with define_direct_property where appropriate.
2021-07-04LibJS: Rewrite most of Object for spec compliance :^)Linus Groh
This is a huge patch, I know. In hindsight this perhaps could've been done slightly more incremental, but I started and then fixed everything until it worked, and here we are. I tried splitting of some completely unrelated changes into separate commits, however. Anyway. This is a rewrite of most of Object, and by extension large parts of Array, Proxy, Reflect, String, TypedArray, and some other things. What we already had worked fine for about 90% of things, but getting the last 10% right proved to be increasingly difficult with the current code that sort of grew organically and is only very loosely based on the spec - this became especially obvious when we started fixing a large number of test262 failures. Key changes include: - 1:1 matching function names and parameters of all object-related functions, to avoid ambiguity. Previously we had things like put(), which the spec doesn't have - as a result it wasn't always clear which need to be used. - Better separation between object abstract operations and internal methods - the former are always the same, the latter can be overridden (and are therefore virtual). The internal methods (i.e. [[Foo]] in the spec) are now prefixed with 'internal_' for clarity - again, it was previously not always clear which AO a certain method represents, get() could've been both Get and [[Get]] (I don't know which one it was closer to right now). Note that some of the old names have been kept until all code relying on them is updated, but they are now simple wrappers around the closest matching standard abstract operation. - Simplifications of the storage layer: functions that write values to storage are now prefixed with 'storage_' to make their purpose clear, and as they are not part of the spec they should not contain any steps specified by it. Much functionality is now covered by the layers above it and was removed (e.g. handling of accessors, attribute checks). - PropertyAttributes has been greatly simplified, and is being replaced by PropertyDescriptor - a concept similar to the current implementation, but more aligned with the actual spec. See the commit message of the previous commit where it was introduced for details. - As a bonus, and since I had to look at the spec a whole lot anyway, I introduced more inline comments with the exact steps from the spec - this makes it super easy to verify correctness. - East-const all the things. As a result of all of this, things are much more correct but a bit slower now. Retaining speed wasn't a consideration at all, I have done no profiling of the new code - there might be low hanging fruits, which we can then harvest separately. Special thanks to Idan for helping me with this by tracking down bugs, updating everything outside of LibJS to work with these changes (LibWeb, Spreadsheet, HackStudio), as well as providing countless patches to fix regressions I introduced - there still are very few (we got it down to 5), but we also get many new passing test262 tests in return. :^) Co-authored-by: Idan Horowitz <idan.horowitz@gmail.com>
2021-07-04Everywhere: Prefer using "..."sv over StringView { "..." }Gunnar Beutner
2021-06-30AK+Everywhere: Add and use static APIs for LexicalPathMax Wipfli
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
2021-06-30Base+Utilities: Add run-tests program to run system tests with LibTestAndrew Kaster
This test program heavily pulls from the JavaScriptTestRunner/test-js, but with a twist. Instead of loading JavaScript files into the current process, constructing a JS environment for them, and executing test suites/tests directly, run-tests posix_spawns each test file. Test file stdout is written to a temp file, and only dumped to console if the test fails or the verbose option is passed to the program. Unlike test-js, times are always printed for every test executed for better visibility in CI.
2021-06-30Userland+Tests: Split out generic test runner from JS TestRunnerAndrew Kaster
Split out the functionality to gather multiple tests from the filesystem and run them in turn into Test::TestRunner, and leave the JavaScript specific test harness logic in Test::JS::TestRunner and friends.
2021-06-12LibJS: Add all of the WeakMap.prototype methods (delete, get, has, set)Idan Horowitz
2021-06-12LibJS: Add support for running test-js with the bytecode interpreterGunnar Beutner
This obviously won't actually successfully run the test suite until more of the AST expressions used by the test suite are supported.
2021-06-11LibTest: Don't try to pass stderr to warnlnHendiadyoin1
2021-06-09LibJS: Notify WeakSets when heap cells are sweepedIdan Horowitz
This is an implementation of the following optional optimization: https://tc39.es/ecma262/#sec-weakref-execution
2021-06-04LibTest: Add --json flag to JS test runnerLinus Groh
This will not show the colorful human-readable file results and final test results summary but instead output a JSON blob containing all test information, which can then be processed by other programs easily.
2021-05-30LibTest+test-js: Add back the lost test262 parser test optionAli Mohammad Pur
Fixes #7566.
2021-05-27LibTest: Do not cleanly exit when abort() is calledAli Mohammad Pur
Instead, do the cleanup, remove the signal handler, and abort() again.
2021-05-25LibTest: Use fstatat() to speed up iterate_directory_recursively()Andreas Kling
Employ the same technique as SpaceAnalyzer to avoid doing full path resolution in the kernel over an over. Starting each path resolution from the base of the directory iterator (using its fd) is significantly faster and reduces test-js runtime by ~3%.
2021-05-18LibJS+LibTest: Move out the test-js test runner into LibTestAli Mohammad Pur
2021-05-08LibTest: Convert Crash test runner to outln(..)Brian Gianforcaro
2021-05-08LibTest: Expose new EXPECT_CRASH(..) macro for unit test assertionsBrian Gianforcaro
Utilize the Crash type we imported into LibTest to support testing of crash scenarios when testing all other components.
2021-05-08LibTest: Move Crash testing facility from crash.cpp to LibTestBrian Gianforcaro
2021-04-29LibTest: Add EXPECT_NE(..) test assertion.Brian Gianforcaro
2021-04-27LibTest: Add FAIL() macro allow tests to force failure with message.Brian Gianforcaro
2021-04-25AK+Userland: Move AK/TestSuite.h into LibTest and rework Tests' CMakeAndrew Kaster
As many macros as possible are moved to Macros.h, while the macros to create a test case are moved to TestCase.h. TestCase is now the only user-facing header for creating a test case. TestSuite and its helpers have moved into a .cpp file. Instead of requiring a TEST_MAIN macro to be instantiated into the test file, a TestMain.cpp file is provided instead that will be linked against each test. This has the side effect that, if we wanted to have test cases split across multiple files, it's as simple as adding them all to the same executable. The test main should be portable to kernel mode as well, so if there's a set of tests that should be run in self-test mode in kernel space, we can accomodate that. A new serenity_test CMake function streamlines adding a new test with arguments for the test source file, subdirectory under /usr/Tests to install the test application and an optional list of libraries to link against the test application. To accomodate future test where the provided TestMain.cpp is not suitable (e.g. test-js), a CUSTOM_MAIN parameter can be passed to the function to not link against the boilerplate main function.
2021-04-23Userland: Use mattco@serenityos.org for my copyright headersMatthew Olsson
2021-04-22Everywhere: Use linusg@serenityos.org for my copyright headersLinus Groh
2021-04-22Everywhere: Use bgianf@serenityos.org for my copyright attributionBrian Gianforcaro
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *