aboutsummaryrefslogtreecommitdiff
path: root/src/test.zig
AgeCommit message (Collapse)Author
2023-02-21Add test coverage for some module structuresmlugg
2023-02-21Implement new module CLImlugg
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-01-22Package: store package name directlymlugg
By @Vexu's suggestion, since fetching the name from the parent package is error-prone and complex, and optimising Package for size isn't really a priority.
2022-12-15test: observe and check note count in error outputStevie Hryciw
2022-12-06test: remove reference to stage1Jacob Young
2022-12-06remove `-fstage1` optionAndrew Kelley
After this commit, the self-hosted compiler does not offer the option to use stage1 as a backend anymore.
2022-11-29std.mem.Allocator: allow shrink to failAndrew Kelley
closes #13535
2022-11-28CLI: more careful resolution of pathsAndrew Kelley
In general, we prefer compiler code to use relative paths based on open directory handles because this is the most portable. However, sometimes absolute paths are used, and sometimes relative paths are used that go up a directory. The recent improvements in 81d2135ca6ebd71b8c121a19957c8fbf7f87125b regressed the use case when an absolute path is used for the zig lib directory mixed with a relative path used for the root source file. This could happen when, for example, running the standard library tests, like this: stage3/bin/zig test ../lib/std/std.zig This happened because the zig lib dir was inferred to be an absolute directory based on the zig executable directory, while the root source file was detected as a relative path. There was no common prefix and so it was not determined that the std.zig file was inside the lib directory. This commit adds a function for resolving paths that preserves relative path names while allowing absolute paths, and converting relative upwards paths (e.g. "../foo") to absolute paths. This restores the previous functionality while remaining compatible with systems such as WASI that cannot deal with absolute paths.
2022-11-21disable failing arm-linux non-llvm backend testsAndrew Kelley
See #13623
2022-11-18run zig fmt on everything checked by CIStevie Hryciw
2022-11-13C backend: improve ergonomics of zig.h a little bitAndrew Kelley
Partially implements #13528. Enough to unblock the wasi-bootstrap branch.
2022-10-25cbe: update test casesJacob Young
2022-10-20Fix #12091: Error message with TERM=dumb is missing infoyujiri8
2022-09-16Merge pull request #12796 from Vexu/referenced-by-v2Veikka Tuominen
stage2: add referenced by trace to compile errors attempt #2 (+ some fixes)
2022-09-14ZIG_EXE envirnoment variable instead of testing build optionsAndrew Kelley
No longer introduce build options for tests. Instead, ZIG_EXE environment variable is added to any invocation of `zig run` or `zig test`. The end result of this branch is the same: there is no longer a mandatory positional command line argument when invoking zig test binaries directly.
2022-09-15stage2: implement referenced by trace for error messagesVeikka Tuominen
Closes #7668 Closes #12141
2022-09-14Move std.testing.zig_exe_path into build optionsMartin Wickham
2022-09-09Merge pull request #12788 from ziglang/detect-native-glibcAndrew Kelley
std.zig.system.NativeTargetInfo: improve glibc version and dynamic linker detection
2022-09-08std.zig.system.NativeTargetInfo: detection ignores self exeAndrew Kelley
Before, native glibc and dynamic linker detection attempted to use the executable's own binary if it was dynamically linked to answer both the C ABI question and the dynamic linker question. However, this could be problematic on a system that uses a RUNPATH for the compiler binary, locking it to an older glibc version, while system binaries such as /usr/bin/env use a newer glibc version. The problem is that libc.so.6 glibc version will match that of the system while the dynamic linker will match that of the compiler binary. Executables with these versions mismatching will fail to run. Therefore, this commit changes the logic to be the same regardless of whether the compiler binary is dynamically or statically linked. It inspects `/usr/bin/env` as an ELF file to find the answer to these questions, or if there is a shebang line, then it chases the referenced file recursively. If that does not provide the answer, then the function falls back to defaults. This commit also solves a TODO to remove an Allocator parameter to the detect() function.
2022-09-07tests: force LLD off for stage2 backends until auto-select deems worthyJakub Konka
2022-09-07test-cases: enable stage2 tests on WindowsJakub Konka
2022-08-19make self-hosted the default compilerAndrew Kelley
stage1 is available behind the -fstage1 flag. closes #89
2022-08-18test harness: fix handling of object formatAndrew Kelley
Follow-up to b975f7a56fec9e0e7aca9832282bc772c743d731.
2022-08-11test-cases: remove multi-threadingAndrew Kelley
This effectively reverts 22690efcc2378222503cb8aaad26a6f4a539f5aa, re-opening #11818. This had the following problems: * Buggy on some targets (macOS, Windows) * Messy output to the terminal These problems need to be solved before moving forward with this.
2022-07-27test-cases harness: annotate an optional typeAndrew Kelley
Not sure why this is needed by the CI; it's not needed locally. This is a mystery that will have to wait for another day.
2022-07-26test-cases harness: refresh just before update()Andrew Kelley
This makes it so that in a -Dsingle-threaded build of test-cases, if a crash happens, the test case name will be printed just before the stderr of the crash.
2022-07-26test-cases harness: improve stage2 compatibilityAndrew Kelley
* proper skip_stage1 mechanism that doesn't get side-stepped with manually added test cases. * avoid runtime-known function pointers. * check for type equality more simply without checking the type name.
2022-07-26test-cases harness: test all updatesAndrew Kelley
even if some are "run" on foreign hosts. closes #12193
2022-07-25std.mem: add `first` method to `SplitIterator` and `SplitBackwardsIterator`r00ster
2022-07-15std.fs: remove `OpenDirOptions.iterate`Veikka Tuominen
2022-07-15std.fs: split `Dir` into `IterableDir`Veikka Tuominen
Also adds safety check for attempting to iterate directory not opened with `iterate = true`.
2022-07-12Compilation: indent multiline error messages properlyr00ster91
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-06-28test: return error on unknown config valueJakub Konka
2022-06-14test-cases: avoid using realpath since it is not portableAndrew Kelley
For example FreeBSD does not support this syscall.
2022-06-14test-cases: fix race with `zig run` on C backend testsAndrew Kelley
Also avoid redundantly doing compile-error checks on multiple targets for test cases where that is not helpful.
2022-06-14multi-thread `zig build test-cases`Andrew Kelley
Instead of always using std.testing.allocator, the test harness now follows the same logic as self-hosted for choosing an allocator - that is - it uses C allocator when linking libc, std.testing.allocator otherwise, and respects `-Dforce-gpa` to override the decision. I did this because I found GeneralPurposeAllocator to be prohibitively slow when doing multi-threading, even in the context of a debug build. There is now a second thread pool which is used to spawn each test case. The stage2 tests are passed the first thread pool. If it were only multi-threading the stage1 tests then we could use the same thread pool for everything. However, the problem with this strategy with stage2 is that stage2 wants to spawn tasks and then call wait() on the main thread. If we use the same thread pool for everything, we get a deadlock because all the threads end up all hanging at wait() and nothing is getting done. So we use our second thread pool to simulate a "process pool" of sorts. I spent most of the time working on this commit scratching my head trying to figure out why I was getting ETXTBSY when spawning the test cases. Turns out it's a fundamental Unix design flaw, already a known, unsolved issue by Go and Java maintainers: https://github.com/golang/go/issues/22315 https://bugs.openjdk.org/browse/JDK-8068370 With this change, the following command, executed on my laptop, went from 6m24s to 1m44s: ``` stage1/bin/zig build test-cases -fqemu -fwasmtime -Denable-llvm ``` closes #11818
2022-06-09test harness: fix handling of countsAndrew Kelley
I'm not really happy with parsing compile errors; I think we should just be checking that the expected compile error matches the actual rendered version. I will save that change for a later date however.
2022-06-08test harness: fix sort comparatorAndrew Kelley
It was returning "true" for lessThan() when the objects were in fact equal.
2022-05-26test: correctly track identical error msgs in handled errors listJakub Konka
Prior to this change, for an example compiler error test case with multiple identical errors messages such as ``` :1:2: error: foo :1:2: error: foo ``` the test harness would never increment the error index thus only marking the very first error message as handled yielding a false positive. Additionally, while here, regress `dereference_anyopaque` test case as not passing on `wasm32-wasi` target.
2022-05-15test harness: Set filename on error returnLuuk de Gram
While calling `next` an error can occur while parsing the file. However, we don't set the filename that is currently being processed, until `next` completed successfully. This means that for invalid test names, the wrong filename was being displayed in the panic message. The fix is to retrieve the correct filename when an error occurs and then setting the filename appropriately.
2022-05-13test harness: actually run the stage1 "run" testsAndrew Kelley
2022-05-13test-cases: honor -Dtest-filter argument from zig buildAndrew Kelley
2022-05-13test harness: dump stderr when compiler crashesAndrew Kelley
2022-05-13migrate runtime safety tests to the new test harnessAndrew Kelley
* migrate runtime safety tests to the new test harness - this required adding compare output / execution support for stage1 to the test harness. * rename `zig build test-stage2` to `zig build test-cases` since it now does quite a bit of stage1 testing actually. I named it this way since the main directory in the source tree associated with these tests is "test/cases/". * add some documentation for the test manifest format.
2022-05-04test: move compile errors and incremental tests into common dirJakub Konka
2022-05-04test: improve test batch/sequence iteratorJakub Konka
With this improved iterator, type of test is now inferred from the filename, enabling us to put all cases in one common parent directory, and iterate over that, thus automating a lot of tasks.
2022-05-02test: regression fix: skip stage1 if not enabledJakub Konka
2022-04-28test: remove redundant codepaths from test harnessJakub Konka
2022-04-28test: migrate stage1 compile error tests to updated test manifestJakub Konka