Commit Graph

8265 Commits

Author SHA1 Message Date
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 6707a5efee Arena allocates text 2026-04-13 01:30:14 -07: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 541bd6c369 Updates more failing tests 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 9edbf00ddf Enables disabled error trace test on Windows 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
David Rubin 06ab4f702e llvm: correctly bitcast for memset intrinsic path 2026-04-12 05:28:54 +02:00
Andrew Kelley 2322d45d80 Merge pull request 'Implement variadic functions for Win64 in the x86_64 backend' (#31672) from kcbanner/zig:win64_varargs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31672
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-12 01:34:16 +02:00
Carl Åstholm c61e18006f Add standalone tests for debug I/O color detection 2026-04-11 12:28:24 -07:00
kcbanner 91dce64d10 - Fixup != .stage2_x86_64 -> == .stage2_llvm in var_args tests 2026-04-11 14:53:55 -04:00
Andrew Kelley 29225ae11b Merge pull request 'x64_86 fix: RMI can accept imm16 only for imul r16,r/m16' (#31234) from mathk/zig:x64_86-misscompfix-rmi16 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31234
Reviewed-by: jacobly <jacobly@noreply.codeberg.org>
2026-04-11 18:08:07 +02:00
Andrew Kelley cbe468a787 Merge pull request 'Sema: allow @round, @floor, @ceil, and @trunc to coerce to integer types' (#30906) from adria/zig:sema-rounding-casts into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30906
2026-04-11 16:44:41 +02:00
Alex Rønne Petersen 8d42a86fb3 test: add powerpc64-ps3-none and x86_64-(ps4,ps5)-none to llvm_targets 2026-04-11 12:55:45 +02:00
Alex Rønne Petersen 3898c815ac test: add mipsel-psp-eabihf to llvm_targets 2026-04-11 12:55:45 +02:00
Alex Rønne Petersen d626dc84d9 test: add s390x-linux-musl to llvm_targets 2026-04-11 12:06:50 +02:00
Alex Rønne Petersen 13839127b9 test: disable incremental tests on wasm32-wasi-selfhosted
https://codeberg.org/ziglang/zig/issues/31810
2026-04-11 04:40:16 +02:00
glowsquid 8111d3d63c fix comptime @ptrcasting from a larger type to a smaller one (#31774)
closes #30180

Note from mlugg: this fix is very much a hack, but it definitely won't break anything and it demonstrably fixes one case, so I'm merging it for now with the expectation that I'll be replacing the broken code soon.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31774
Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
Co-authored-by: glowsquid <sachabarsayuracko@gmail.com>
Co-committed-by: glowsquid <sachabarsayuracko@gmail.com>
2026-04-10 23:31:21 +02:00
David 2c6e5006ed Sema: fix comptime @ptrCast to optional slices 2026-04-10 23:27:13 +02:00
Mathieu Suen 244f5aafca fixup! Adding unwrapped error multiply regression test 2026-04-10 23:23:33 +02:00
Mathieu Suen 7addae8f7d Adding unwrapped error multiply regression test 2026-04-10 23:23:33 +02:00
Jacob Young 1552bc7ad0 x86_64: fix mir rmi signedness 2026-04-10 23:23:33 +02:00
Matthew Lugg 998b714708 Sema: push to error trace when returning from inline function
There is no reason `inline fn`s should not be subject to error tracing:
they are still functions! So, push to the error trace when we return
from one, and add a test checking that inline functions do appear in
error traces.

This also changes how we emit error trace pushes: we no longer duplicate
the AIR `ret` instruction in the "error" and "non-error" code paths. I
suspect this will lead to slightly better unoptimized codegen, but I may
be wrong---I'll take some performance measurements before I merge this.
2026-04-10 23:17:22 +02:00
pentuppup 6193470cee error on tuples in extern contexts 2026-04-08 15:22:48 +02:00
Neel 86853ba0a4 Add RISC-V ABI register alias names for inline asm clobbers 2026-04-08 14:37:48 +02:00
Jan200101 9fd63daff2 std.Build.Step.ConfigHeader: handle leading whitespace for cmake 2026-04-08 14:24:48 +02:00
Alex Rønne Petersen a38c6bbcc4 test: disable incremental tests on x86_64-windows-selfhosted
https://codeberg.org/ziglang/zig/issues/31773
2026-04-06 23:04:14 +02:00
Pavel Verigo ad7a028228 stage2-wasm: pass incremental tests
This PR enables all incremental tests under the `test/incremental` directory, except one: `change_exports`, which is currently ignored as it requires a non-trivial amount of work on the linker, since we do not currently support exporting data symbols.

To enable the other tests, the following fixes were needed:

1. `src/link/Wasm.zig`: instead of chasing function type through Nav, get it directly.
2. `src/target.zig`: `.panic_fn` appears to work fine with the wasm backend.
3. `src/codegen/wasm/CodeGen.zig`: there was a liveness related bug that caused some `ArenaAllocator` code to crash the backend.

More info on (3), the liveness and local reuse code in the backend for years in unfinished state. For example there is currently no branch merging and reuse happens only when inst die in same block level. I initially considered doing a large refactor to implement everything correctly, but aborted due to its sheer size and currently! no clear idea about how to do this efficiently.

Instead, I fixed the bug with minimal changes and removed useless code, keeping the old solution otherwise intact.
2026-04-04 15:21:35 +02:00
rpkak 90ccd6051c test-libc: do not skip search_hsearch on wasi-libc
emmalloc is not used anymore
2026-04-03 13:28:33 +02:00
Kendall Condon d8ba173e5e multiprocess fuzzing
- New Features

-- Multiprocess Fuzzing

The fuzzer now is able to utilize multiple cores. This is controllable
with the `-j` build option. Limited fuzzing still uses one core.

-- Fuzzing Infinite Mode

When provided multiple tests, the fuzzer now switches between them and
prioritizes the most effective and interesting ones. Over time already
explored tests will become barely run compared to tests yielding new
inputs.

-- Crash Dumps

Crashing inputs are now saved to a file indicated by the crash message.
It is recommended to use these files to reproduce the crash using
`std.testing.FuzzInputOptions.corpus` and @embedFile.

- Design

Each fuzzing process is assigned an instance id which has the following
uses:
* In conjunction with the pc hash and running test index, they uniquely
  identify input files in the case of a crash.
* It is combined with the test seed for a unique rng seed.
* Instance 0 is solely responsible for syncing the filesystem corpus.

When new inputs are found, they are sent to the build server. It then
distributes the new input to the other instances. Each instance has a
concurrent poller managed by the test runner which sends received
inputs to libfuzzer. (note that this is affected by #31718 and so can
(rarely) deadlock)

For fuzzing infinite mode, the test runner now receives a list of tests
from the build server. The fuzzer runs tests in batches of one second,
approximated in cycles by the previous batch's run speed. Tests finding
new inputs or with few runs are given a higher run chance. The baseline
run chance is based off the recency of the last find and the number of
pcs the test has hit.
2026-04-03 12:27:34 +02:00
mihael e15d8dd3d2 libc-test/math: Enable rint tests
The `rint` tests were commented out when added along with other functions to
the `libc-test` runner, presumably because they were failing. In the meantime,
we moved to using a Zig-implemented `rint` and I found that the tests are now
passing. To celebrate, I'm putting them back into commission.

Having these tests in a working state is nice because functions like `lrint`,
`llrint`, and `nearbyint` depend on `rint` implementation being correct.

Results:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=rint -fqemu -fwasmtime --summary line
Build Summary: 2209/2209 steps succeeded
```
2026-04-02 23:54:19 +02:00
Alex Rønne Petersen 7f3c1329f8 libc-test: disable pthread_cond-smasher.c
Prone to flaky timeouts under heavy load.
2026-04-02 20:53:45 +02:00
Pavel Verigo 557caecaaa stage2-wasm: start big int support 2026-04-02 15:48:43 +02:00
Andrew Kelley 3e0f55fcc7 Merge pull request 'add an ast smith' (#31635) from gooncreeper/zig:ast-smith into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31635
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-02 15:41:05 +02:00
badayvedat 6cdd576d41 libzigc: fdim 2026-04-02 14:50:19 +02:00
Jacob Young 28ae5d4158 llvm: fix missing return attributes
Closes #31636
2026-04-02 14:31:12 +02:00
Alex Rønne Petersen dd10d3fb52 libc-test: disable pthread_cancel-points.c
This test is racey if multiple instances of it run concurrently.
2026-04-02 12:33:19 +02: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
Matthew Lugg 4a494a8cf9 tests: enable incremental tests for x86_64-linux-llvm
These all pass now! I have also removed the warning about the LLVM
backend not supporting incremental compilation; I expect it will work
sort of okay in practice by now.
2026-03-28 16:50:43 +00:00
kcbanner 2b72c0d304 - Fixup producesCompilerRtDynLib conditions
- Fixup skipping the new float varags test on .stage2_llvm
2026-03-28 02:51:20 -04:00
Alex Rønne Petersen 49fa67d826 fixup 58490f588c 2026-03-27 02:49:12 +01:00
Alex Rønne Petersen 58490f588c test: disable standalone test run_output_caching on windows
https://codeberg.org/ziglang/zig/issues/31564
2026-03-27 02:24:23 +01: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