538 Commits

Author SHA1 Message Date
Alex Rønne Petersen a83aad152b Merge pull request 'LLVM 22' (#32013) from llvm22 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32013
2026-04-26 07:03:38 +02:00
Andrew Kelley e7d74e49b0 declare linker test bankruptcy
The active contributors and maintainers of Zig's linker code have
generally found the current linker test harness to be cumbersome. The
tests require a lot of maintenance, but do not provide a lot of
coverage, and when they fail it is painful to troubleshoot.

Furthermore, as part of working on #31691, I don't want to port over the
CheckObject step, because I don't like the code anyway.

The plan forward is to start enhancing `zig objdump` to assist in
linker development, as well as using it as the basis for snapshot
testing.

We absolutely need linker test coverage, but we need to try to improve
these things about the next attempt:
* less effort to create and maintain tests
* less CPU overhead - we should be able to add a lot of tests without
  adding a lot of CI time.
* more helpful failures. A failed linker test should provide the next
  steps a developer can take to understand why the test failed.
* a goal of porting over all of LLD's test suite, or at least the good
  ones.

I'm not going to open an issue to track the lost linker test coverage,
because there was already so much lack of coverage for linker stuff.

However I will open issues to track this lost coverage:
* the deleted checks from test/standalone/glibc_compat/build.zig
* the deleted checks from test/standalone/compiler_rt_panic/build.zig
* the deleted checks from test/standalone/ios/build.zig
2026-04-26 00:15:07 +02:00
Alex Rønne Petersen d3ee286511 test: add loongarch64-linux-muslsf to test-c-abi matrix 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 1bd9f3f4f2 test: add loongarch64-linux-(gnu,musl)sf to test-modules matrix 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen a9fbcb7c67 test: add loongarch32-linux-none to test-modules matrix 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen cc022047c3 Revert "test: disable hexagon-linux-musl C ABI tests for now"
This reverts commit fce7878a91.

The bug was fixed in LLVM 22.
2026-04-25 21:54:48 +02:00
Jacob Young ea45895a2d tests: cleanup c abi test runner 2026-04-22 13:19:44 -04:00
Jacob Young c0e90312fc test: c abi regression tests for aarch64 failures 2026-04-22 14:35:22 +02:00
Pavel Verigo 22945fbbdc stage2-wasm: vector, std tests 2026-04-22 00:19:46 +02:00
Alex Rønne Petersen 7ea8f842bc libzigc: move all unit tests from lib/c/ to test/c/
Before:

* test-zigc: run libzigc unit tests (part of test-modules)
* test-libc: run libc-test cases

Now:

* test-libc: run libc API unit tests (part of test-modules)
* test-libc-nsz: run libc-test cases

libc API unit tests (previously referred to as libzigc unit tests) now run for
all supported targets, even those we don't provide libzigc for. The idea is that
this will help us catch bad assumptions in the unit tests, as well as bugs in
other libcs.

I considered this setup:

* test-c: run libc API unit tests (part of test-modules)
* test-libc-nsz: run libc-test cases
* test-libc: both of the above

However, I do not like it because it gives a false sense of security; the full
module and C ABI test suites are still liable to catch libzigc bugs that test-c
and test-libc-nsz might not. So contributors should just run the test steps
outlined in https://codeberg.org/ziglang/zig/issues/30978.

Co-authored-by: rpkak <rpkak@noreply.codeberg.org>
2026-04-17 12:10:37 +02:00
Alex Rønne Petersen 3e1e625814 test: handle -Dskip-libc correctly for module tests
For a test target with link_libc = null, we need to skip it if we would
implicitly link libc because the target requires it or because we don't yet have
a syscall layer for it.
2026-04-17 12:10:37 +02:00
Alex Rønne Petersen 504ebf85c4 test: reinstate compiler-rt and zigc tests with different LLVM bug workarounds
ref https://codeberg.org/ziglang/zig/issues/31701
ref https://codeberg.org/ziglang/zig/issues/31702
2026-04-16 19:28:59 +02:00
Matthew Lugg 291addadf8 tests: move incremental target matrix out of manifests
Having the matrix of test targets for incremental compilation in the
individual test manifests has turned out to be inconvenient for a few
reasons: the tests are almost certain to accidentally get out of sync,
disabling targets entirely is annoying to do, and incr-check needs to
take care to print the target in all error messages (which currently
does not always happen).

If I recall correctly, I originally designed it this way because it
allows targets to be disabled at the granularity of individual tests,
but there's an easier approach to that: just let a test manifest that it
should be *skipped* on a certain target! As skipping is the rare case,
and also the case you want readers to notice, it makes sense for *it* to
be explicitly specified, like how unit tests use `error.SkipZigTest`.

So, `incr-check` no longer runs through a list of targets specified in
the manifest. Instead, it accepts (and, in fact, requires) a single
target on the command line, and runs the test for that specific target.
If the file contains a `#skip_target` directive for that target, then
`incr-check` exits immediately, so we can still disable targets at
individual test granularity, but you can also disable a target for all
tests by just commenting it out of the matrix in `test/tests.zig`.

As a nice bonus, this also allows the build system to run different
incremental test targets in parallel, because the targets are now
different steps.

This definitely seems like a better way to split the work between the
build system and incr-check---sorry for getting this wrong initially!
2026-04-15 00:06:18 +02:00
Mason Remaley df2413cf69 Removes dead code, updates some tests, fixes typos in comments, formats 2026-04-12 04:01:30 -07:00
Mason Remaley ac207073f3 Reverts renaming of builtin.StackTrace -> ErrorReturnTrace
We can defer this change until the next time zig1 needs to be updated
2026-04-12 04:01:30 -07:00
Mason Remaley 825ba5a350 Adds tests for inline traces 2026-04-12 04:01:30 -07:00
Mason Remaley dcdb562c15 Adds support for running the trace tests through darling, fixes compilation errors in MachO due to interface change 2026-04-12 04:01:30 -07:00
Mason Remaley 492efd4c06 Adds support for running stack and error trace tests through Wine
Also fixes minor bug that was preventing existing tests from passing on
32 bit Windows
2026-04-12 04:01:30 -07:00
Mason Remaley 94ff38af87 Separates error return traces from stack traces
Doesn't commit the changes to stage1, we can generate those at the end
once we're not making any more changes to it to avoid wasting storage.
2026-04-12 04:01:29 -07:00
Matthew Lugg abaf3dfbe9 tests: fix wouldUseLlvm on x86_64-windows 2026-03-28 19:25:01 +00:00
Matthew Lugg 2ac47fe314 tests: disable safe compiler-rt tests on LLVM
Disabling due to multiple LLVM bugs:
* https://codeberg.org/ziglang/zig/issues/31701
* https://codeberg.org/ziglang/zig/issues/31702
2026-03-28 19:25:01 +00:00
Matthew Lugg 29faeeee9d tests: fix passing -fno-builtin to module tests 2026-03-28 16:50:43 +00:00
Alex Rønne Petersen 6bdb45beaf test: don't run test-zigc on targets that don't support libzigc 2026-03-26 08:48:38 +01:00
Alex Rønne Petersen a216c74131 test: partial revert of ac793232ee
This is just obviously wrong?! I'm fairly certain I didn't intend to push that
commit in that state.
2026-03-26 05:50:51 +01:00
Alex Rønne Petersen cef16b5130 std.Target: don't claim that OpenBSD requires libc
https://codeberg.org/ziglang/zig/issues/30982
2026-03-26 05:50:51 +01:00
Jacob Young 9ac1386c10 std.Io.Threaded: windows networking without ws2_32 2026-03-18 20:13:59 -04:00
Justus Klausecker 933bfd4282 tests: pass on -Dsanitize-thread to unit tests 2026-03-06 10:09:06 +01:00
Kendall Condon 5b9bb0a404 add -Dfuzz-only
Runs only one configuration suitable for fuzzing.
2026-02-13 17:58:09 -05:00
Alex Rønne Petersen fce7878a91 test: disable hexagon-linux-musl C ABI tests for now
https://gitlab.com/qemu-project/qemu/-/issues/3291
2026-02-04 11:11:39 +01:00
Alex Rønne Petersen e437efd601 test: enable thumb-windows-gnu module tests
We use long calls for these just like thumb*-linux-* to prevent range issues as
the binaries grow larger over time.

We also need function and data sections due to the many __stack_chk_guard
references within the std test binary; without these options, the linker is not
able to insert range thunks in between functions because the std binary just has
one giant .text section that's opaque to the linker.

closes https://codeberg.org/ziglang/zig/issues/30923
2026-01-23 21:16:03 +01:00
Alex Rønne Petersen 34aa1bb94f test-libc: enable loongarch64-linux-muslsf 2026-01-21 17:53:38 +01:00
Alex Rønne Petersen ac793232ee test: skip non-libc module tests for targets that require or default to libc
We were just creating duplicate work and breaking -Dskip-libc.
2026-01-19 13:16:25 +01:00
rpkak b94a65ed40 test-libc: run some math tests 2026-01-10 00:09:54 +01:00
Alex Rønne Petersen 00dc4d000f test: add openbsd targets to module test matrix 2026-01-05 16:50:46 +01:00
Andrew Kelley b4dbe483a7 std.Build: adjust temp files API
Remove the RemoveDir step with no replacement. This step had no valid
purpose. Mutating source files? That should be done with
UpdateSourceFiles step. Deleting temporary directories? That required
creating the tmp directories in the configure phase which is broken.
Deleting cached artifacts? That's going to cause problems.

Similarly, remove the `Build.makeTempPath` function. This was used to
create a temporary path in the configure place which, again, is the
wrong place to do it.

Instead, the WriteFile step has been updated with more functionality:

tmp mode: In this mode, the directory will be placed inside "tmp" rather
than "o", and caching will be skipped. During the `make` phase, the step
will always do all the file system operations, and on successful build
completion, the dir will be deleted along with all other tmp
directories. The directory is therefore eligible to be used for
mutations by other steps. `Build.addTempFiles` is introduced to
initialize a WriteFile step with this mode.

mutate mode: The operations will not be performed against a freshly
created directory, but instead act against a temporary directory.
`Build.addMutateFiles` is introduced to initialize a WriteFile step with
this mode.

`Build.tmpPath` is introduced, which is a shortcut for
`Build.addTempFiles` followed by `WriteFile.getDirectory`.

* give Cache a gpa rather than arena because that's what it asks for
2026-01-04 17:23:45 -08:00
Andrew Kelley 2fee64ceb0 update init template for new main API 2026-01-04 00:27:09 -08:00
Andrew Kelley 32af0f6154 std: move child process APIs to std.Io
this gets the build runner compiling again on linux

this work is incomplete; it only moves code around so that environment
variables can be wrangled properly. a future commit will need to audit
the cancelation and error handling of this moved logic.
2026-01-04 00:27:08 -08:00
Andrew Kelley a7d2cb7045 test-incremental: ignore .swp files 2025-12-26 19:58:56 -08:00
Andrew Kelley 66da6773eb build: make test-incremental respect -Dtest-filter 2025-12-26 19:58:56 -08:00
Andrew Kelley a72c411fdb disable self-hosted aarch64 tests
These can be re-enabled when the assertion failures in the backend are
fixed, which does not need to block this branch.
2025-12-26 19:58:56 -08:00
Andrew Kelley b45984ec80 test-incremental: respect the wine, qemu, etc build flags 2025-12-23 22:15:12 -08:00
Andrew Kelley 6e0c7ed865 std: rename makeDir to createDir for consistency with createFile 2025-12-23 22:15:11 -08:00
Andrew Kelley bee8005fe6 std.heap.DebugAllocator: never detect TTY config
instead, allow the user to set it as a field.

this fixes a bug where leak printing and error printing would run tty
config detection for stderr, and then emit a log, which is not necessary
going to print to stderr.

however, the nice defaults are gone; the user must explicitly assign the
tty_config field during initialization or else the logging will not have
color.

related: https://github.com/ziglang/zig/issues/24510
2025-12-23 22:15:08 -08:00
Andrew Kelley ebdbbd20ac update makeDir() sites to specify permissions 2025-12-23 22:15:08 -08:00
Andrew Kelley 9e3bda5eff tests: close() -> close(io) 2025-12-23 22:15:08 -08:00
Andrew Kelley a91c6dc71d test: std.fs.File -> std.Io.File 2025-12-23 22:15:08 -08:00
Pavel Verigo bf58a3bc08 stage2_wasm: revival, enabling tests 2025-12-07 07:21:15 +01:00
Alex Rønne Petersen 2728eb5d5e build: adjust max_rss on a per-CI-host basis
This avoids pessimizing concurrency on all machines due to e.g. the macOS
machine having high memory usage across the board due to 16K page size.

This also adds max_rss to test-unit and test-c-abi since those tend to eat a
decent chunk of memory too.
2025-12-04 20:06:12 +01:00
Alex Rønne Petersen e2a9e568b4 build: add -Dskip-spirv and -Dskip-wasm options 2025-12-04 03:46:35 +01:00
Alex Rønne Petersen e11901c1a1 test: enable C ABI tests on s390x-linux 2025-11-19 01:42:45 +01:00