aboutsummaryrefslogtreecommitdiff
path: root/test/src/Cases.zig
AgeCommit message (Collapse)Author
2025-10-29disable self-hosted wasm test-casesAndrew Kelley
Tracked by #25684
2025-10-29std: updating to std.Io interfaceAndrew Kelley
got the build runner compiling
2025-09-24delete all the translate-c testsAndrew Kelley
the ziglang/translate-c package has its own test suite, so these are redundant
2025-09-16test: delete old stage1 compile_errors testsAlex Rønne Petersen
generic_function_returning_opaque_type.zig was salvaged as it's still worth having.
2025-09-16test: rename backend=stage2 to backend=selfhosted, and add backend=autoAlex Rønne Petersen
backend=auto (now the default if backend is omitted) means to let the compiler pick whatever backend it wants as the default. This is important for platforms where we don't yet have a self-hosted backend, such as loongarch64. Also purge a bunch of redundant target=native.
2025-09-16test: remove test-compare-output and test-asm-link testsAlex Rønne Petersen
These were low value and unfocused tests. We already have coverage of the important aspects of these tests elsewhere. Additionally, there was really no need for these to have their own test harness.
2025-08-30upgrade more old API usesAndrew Kelley
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-02build: add -Dskip-compile-errors optionAlex Rønne Petersen
Skips tests in test/cases/compile_errors.
2025-07-26aarch64: implement some safety checksJacob Young
Closes #24553
2025-07-26Migrate from deprecated `Step.Compile` APIsCarl Åstholm
2025-07-24Revert "disable -fno-llvm -target wasm32-wasi testing"Pavel Verigo
This reverts commit 83960e0eb068f786c46c3fe559016e1e9faea3cd.
2025-07-19disable -fno-llvm -target wasm32-wasi testingAndrew Kelley
no active maintainer, and it's failing to lower some basic stuff
2025-07-03test: Respect various test skip options in test-casesAlex Rønne Petersen
2025-06-19Target: pass and use locals by pointer instead of by valueJacob Young
This struct is larger than 256 bytes and code that copies it consistently shows up in profiles of the compiler.
2025-06-19Build: change how the target is printed in step namesJacob Young
e.g. `x86_64-windows.win10...win11_dt-gnu` -> `x86_64-windows-gnu` When the OS version is the default this is redundant with checking the default in the standard library.
2025-06-01cases: include dirname in case namesmlugg
For instance, the file 'cases/compile_errors/undeclared_identifier.zig' now corresponds to test name 'compile_errors.undeclared_identifier'. This is useful because you can now filter based on the case dirname using `-Dtest-filter`.
2025-05-12Merge pull request #23700 from sorairolake/rename-trimsAlex Rønne Petersen
chore(std.mem): Rename `trimLeft` and `trimRight` to `trimStart` and `trimEnd`
2025-04-27test: Configure emit_asm/emit_bin correctly for some targets in llvm_targets.Alex Rønne Petersen
2025-04-27test: Allow cases to set emit_asm (defaults to false).Alex Rønne Petersen
2025-04-27chore(std.mem): Rename `trimLeft` and `trimRight`Shun Sakai
Rename `trimLeft` to `trimStart`, and `trimRight` to `trimEnd`. `trimLeft` and `trimRight` functions remain as deprecated aliases for these new names.
2025-04-13std: eradicate u29 and embrace std.mem.AlignmentAndrew Kelley
2025-02-23cases: remove old incremental case systemmlugg
We now run incremental tests with `tools/incr-check.zig` (with the actual cases being in `test/incremental/`).
2025-02-15test: fix windows CIJacob Young
2025-02-03compiler,std: implement ZON supportMason Remaley
This commit allows using ZON (Zig Object Notation) in a few ways. * `@import` can be used to load ZON at comptime and convert it to a normal Zig value. In this case, `@import` must have a result type. * `std.zon.parse` can be used to parse ZON at runtime, akin to the parsing logic in `std.json`. * `std.zon.stringify` can be used to convert arbitrary data structures to ZON at runtime, again akin to `std.json`.
2025-01-24all: update for `panic.unwrapError` and `panic.call` signature changesmlugg
2025-01-22std.Build: add `addLibrary` function (#22554)BratishkaErik
Acts as a replacement for `addSharedLibrary` and `addStaticLibrary`, but linking mode can be changed more easily in build.zig, for example: In library: ```zig const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode for a foo_bar library") orelse .static; // or other default const lib = b.addLibrary(.{ .linkage = linkage, .name = "foo_bar", .root_module = mod, }); ``` In consumer: ```zig const dep_foo_bar = b.dependency("foo_bar", .{ .target = target, .optimize = optimize, .linkage = .static // or dynamic }); mod.linkLibrary(dep_foor_bar.artifact("foo_bar")); ``` It also matches nicely with `linkLibrary` name. Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
2024-12-18test-run-translated-c: migrate from deprecated std.Build APIsmlugg
2024-12-18test-cases: migrate from deprecated std.Build APIsmlugg
2024-11-28test: Change llvm_targets to actually emit an object for each target.Alex Rønne Petersen
Without doing this, we don't actually test whether the data layout string we generate matches LLVM's. A number of targets had to be commented out due to this change: * Some are using a non-working experimental LLVM backend (arc, csky, ...). * Some don't have working LLD support (lanai, sparc, ...). * Some don't have working self-hosted linker support (nvptx). * Some are using ABIs that haven't been standardized (loongarch32). Finally, all non-x86 uefi targets are hopelessly broken and can't really be fixed until we change our emit logic to lower *-uefi-* verbatim rather than to *-windows-*. See: https://github.com/ziglang/zig/issues/21630
2024-11-24test: Allow tests to set emit_bin=false.Alex Rønne Petersen
2024-11-24test: Force compile test cases to be codegen'd if requested.Alex Rønne Petersen
2024-11-24test: Allow setting PIC/PIE in test cases.Alex Rønne Petersen
2024-11-24test: Enable -Dtest-target-filter=... to work for test-cases and ↵Alex Rønne Petersen
test-translate-c.
2024-10-27spirv: forbid merging logical pointersRobin Voetter
Under some architecture/operating system combinations it is forbidden to return a pointer from a merge, as these pointers must point to a location at compile time. This adds a check for those cases when returning a pointer from a block merge.
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-07-04compiler: rework type resolution, fully resolve all typesmlugg
I'm so sorry. This commit was just meant to be making all types fully resolve by queueing resolution at the moment of their creation. Unfortunately, a lot of dominoes ended up falling. Here's what happened: * I added a work queue job to fully resolve a type. * I realised that from here we could eliminate `Sema.types_to_resolve` if we made function codegen a separate job. This is desirable for simplicity of both spec and implementation. * This led to a new AIR traversal to detect whether any required type is unresolved. If a type in the AIR failed to resolve, then we can't run codegen. * Because full type resolution now occurs by the work queue job, a bug was exposed whereby error messages for type resolution were associated with the wrong `Decl`, resulting in duplicate error messages when the type was also resolved "by" its owner `Decl` (which really *all* resolution should be done on). * A correct fix for this requires using a different `Sema` when performing type resolution: we need a `Sema` owned by the type. Also note that this fix is necessary for incremental compilation. * This means a whole bunch of functions no longer need to take `Sema`s. * First-order effects: `resolveTypeFields`, `resolveTypeLayout`, etc * Second-order effects: `Type.abiAlignmentAdvanced`, `Value.orderAgainstZeroAdvanced`, etc The end result of this is, in short, a more correct compiler and a simpler language specification. This regressed a few error notes in the test cases, but nothing that seems worth blocking this change. Oh, also, I ripped out the old code in `test/src/Cases.zig` which introduced a dependency on `Compilation`. This dependency was problematic at best, and this code has been unused for a while. When we re-enable incremental test cases, we must rewrite their executor to use the compiler server protocol.
2024-07-04build: fix WriteFile and addCSourceFiles not adding LazyPath depsJonathan Marler
Adds a missing call to addLazyPathDependenciesOnly in std.Build.Module.addCSourceFiles. Also fixes an issue in std.Build.Step.WriteFile where it wasn't updating all the GeneratedFile instances for every directory. To fix the second issue, I removed all the GeneratedFile instances and now all files/directories reference the steps main GeneratedFile via sub paths.
2024-05-29rename zig-cache to .zig-cacheAndrew Kelley
closes #20077
2024-05-27translate-c tests: skip_foreign_checks=trueAndrew Kelley
2024-05-27test cases: try running foreign binariesAndrew Kelley
You don't know if it's possible to run a binary until you try. The build system already integrates with executors and has the `skip_foreign_checks` for exactly this use case.
2024-05-26std: restructure child process namespaceAndrew Kelley
2024-05-03Rename Dir.writeFile2 -> Dir.writeFile and update all callsitesRyan Liptak
writeFile was deprecated in favor of writeFile2 in f645022d16361865e24582d28f1e62312fbc73bb. This commit renames writeFile2 to writeFile and makes writeFile2 a compile error.
2024-04-22ComptimeStringMap: return a regular struct and optimizeTravis Staloch
this patch renames ComptimeStringMap to StaticStringMap, makes it accept only a single type parameter, and return a known struct type instead of an anonymous struct. initial motivation for these changes was to reduce the 'very long type names' issue described here https://github.com/ziglang/zig/pull/19682. this breaks the previous API. users will now need to write: `const map = std.StaticStringMap(T).initComptime(kvs_list);` * move `kvs_list` param from type param to an `initComptime()` param * new public methods * `keys()`, `values()` helpers * `init(allocator)`, `deinit(allocator)` for runtime data * `getLongestPrefix(str)`, `getLongestPrefixIndex(str)` - i'm not sure these belong but have left in for now incase they are deemed useful * performance notes: * i posted some benchmarking results here: https://github.com/travisstaloch/comptime-string-map-revised/issues/1 * i noticed a speedup reducing the size of the struct from 48 to 32 bytes and thus use u32s instead of usize for all length fields * i noticed speedup storing KVs as a struct of arrays * latest benchmark shows these wall_time improvements for debug/safe/small/fast builds: -6.6% / -10.2% / -19.1% / -8.9%. full output in link above.
2024-03-08test manifest key checking and other fixesfebruary cozzocrea
This commit adds several fixes and improvements for the Zig compiler test harness. 1. -Dskip-translate-c option added for skipping the translate-c tests. 2. translate-c/run-translated-c tests in test/cases/* have been added to the steps test-translate-c and test-run-translated-c. Closes #18224. 3. Custom name added to the CheckFile step for the translate-c step to better communicate which test failed. 4. Test manifest key validation added to return an error if a manifest contains an invalid key.
2024-02-25test: rework how filtering worksJacob Young
* make test names contain the fully qualified name * make test filters match the fully qualified name * allow multiple test filters, where a test is skipped if it does not match any of the specified filters
2024-02-09Merge pull request #18712 from Vexu/std.optionsAndrew Kelley
std: make options a struct instance instead of a namespace
2024-02-02std.Build: implement --host-target, --host-cpu, --host-dynamic-linkerAndrew Kelley
This also makes a long-overdue change of extracting common state from Build into a shared Graph object. Getting the semantics right for these flags turned out to be quite tricky. In the end it works like this: * The override only happens when the target is fully native, with no additional query parameters, such as versions or CPU features added. * The override affects the resolved Target but leaves the original Query unmodified. * The "is native?" detection logic operates on the original, unmodified query. This makes it possible to provide invalid host target information, causing confusing errors to occur. Don't do that. There are some minor breaking changes to std.Build API such as the fact that `b.zig_exe` is now moved to `b.graph.zig_exe`, as well as a handful of other similar flags.
2024-02-01std: make options a struct instance instead of a namespaceVeikka Tuominen
2024-01-26align naming and fix module creation from TranslateCTobias Simetsreiter