aboutsummaryrefslogtreecommitdiff
path: root/test/cases.zig
AgeCommit message (Collapse)Author
2025-10-04test: remove ad-hoc nvptx testsAlex Rønne Petersen
These were just testing random things in the LLVM NVPTX backend. That's not really our job.
2024-03-28remove `test/cbe.zig`Veikka Tuominen
The C backend is far enough along for these tests to be redundant with all the other tests.
2024-01-01zig build system: change target, compilation, and module APIsAndrew Kelley
Introduce the concept of "target query" and "resolved target". A target query is what the user specifies, with some things left to default. A resolved target has the default things discovered and populated. In the future, std.zig.CrossTarget will be rename to std.Target.Query. Introduces `std.Build.resolveTargetQuery` to get from one to the other. The concept of `main_mod_path` is gone, no longer supported. You have to put the root source file at the module root now. * remove deprecated API * update build.zig for the breaking API changes in this branch * move std.Build.Step.Compile.BuildId to std.zig.BuildId * add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions, std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and std.Build.TestOptions. * remove `std.Build.constructCMacro`. There is no use for this API. * deprecate `std.Build.Step.Compile.defineCMacro`. Instead, `std.Build.Module.addCMacro` is provided. - remove `std.Build.Step.Compile.defineCMacroRaw`. * deprecate `std.Build.Step.Compile.linkFrameworkNeeded` - use `std.Build.Module.linkFramework` * deprecate `std.Build.Step.Compile.linkFrameworkWeak` - use `std.Build.Module.linkFramework` * move more logic into `std.Build.Module` * allow `target` and `optimize` to be `null` when creating a Module. Along with other fields, those unspecified options will be inherited from parent `Module` when inserted into an import table. * the `target` field of `addExecutable` is now required. pass `b.host` to get the host target.
2023-08-01llvm: fix data layout calculation for experimental llvm targetsJacob Young
Closes #16616
2023-07-23test: test for issues starting codegen on many targetsJacob Young
Specifically this is to make sure llvm data layout generation doesn't regress. The no emit bin is to allow testing targets that can't currently be linked. The commented out targets are ones that fail in the linker anyway when no emit bin is passed.
2023-03-15re-enable test-cases and get them all passingAndrew Kelley
Instead of using `zig test` to build a special version of the compiler that runs all the test-cases, the zig build system is now used as much as possible - all with the basic steps found in the standard library. For incremental compilation tests (the ones that look like foo.0.zig, foo.1.zig, foo.2.zig, etc.), a special version of the compiler is compiled into a utility executable called "check-case" which checks exactly one sequence of incremental updates in an independent subprocess. Previously, all incremental and non-incremental test cases were done in the same test runner process. The compile error checking code is now simpler, but also a bit rudimentary, and so it additionally makes sure that the actual compile errors do not include *extra* messages, and it makes sure that the actual compile errors output in the same order as expected. It is also based on the "ends-with" property of each line rather than the previous logic, which frankly I didn't want to touch with a ten-meter pole. The compile error test cases have been updated to pass in light of these differences. Previously, 'error' mode with 0 compile errors was used to shoehorn in a different kind of test-case - one that only checks if a piece of code compiles without errors. Now there is a 'compile' mode of test-cases, and 'error' must be only used when there are greater than 0 errors. link test cases are updated to omit the target object format argument when calling checkObject since that is no longer needed. The test/stage2 directory is removed; the 2 files within are moved to be directly in the test/ directory.
2022-10-15re-enable nvptx testsGuillaume Wenzek
2022-04-28test: migrate stage1 compile error tests to updated test manifestJakub Konka
2022-04-28test: migrate llvm incremental testsJakub Konka
2022-04-28test: migrate plan9 and sparcv9 incremental testsJakub Konka
2022-04-28test: migrate arm incremental testsJakub Konka
2022-04-28test: migrate aarch64 incremental testsJakub Konka
2022-04-28test: migrate riscv64 incremental testsJakub Konka
2022-04-28test: migrate wasm incremental testsJakub Konka
2022-04-14stage2: sparcv9: Load tests to the list of testcasesKoakuma
2022-03-14disable failing nvptx test casesAndrew Kelley
See #10968
2022-03-12fix nvptx test failure #10968Guillaume Wenzek
allow test cases to chose wether to link libc or not. default behavior is to not link libc, except for `exeUsingLLVMBackend`
2022-02-21disable failing nvptx test caseAndrew Kelley
workaround for #10968
2022-02-21enable Gpu address spaces (#10884)gwenzek
2021-12-15stage2: clean up testsJakub Konka
* move darwin tests into respective architecture test files: `x86_64` and `aarch64` * run majority of `x86_64` tests on macOS
2021-11-29wasm: Update wasm stage2 test backend to use 'main'Luuk de Gram
2021-11-19stage2: re-enable all testsJakub Konka
I've committed what I didn't want to by mistake...
2021-11-19stage2,x86_64: revert fixing callee preserved regsJakub Konka
This will require further rework in the codegen so reverting for now.
2021-11-19add tests for previous commitJacob G-W
2021-09-22Fix failing tests and windows link dependenciesMartin Wickham
2021-09-20Address Spaces: fmt a bunch of stuffRobin Voetter
2021-09-20Address Spaces: Move stage 2 tests to stage2/llvm.zigRobin Voetter
2021-09-20Address Spaces: compiles() test casesRobin Voetter
2021-09-20Address Spaces: Pointer coercion errors testsRobin Voetter
2021-09-20Address Spaces: Address space on local variable testRobin Voetter
2021-09-16stage2: implement `@setAlignStack` and 128-bit cmpxchgAndrew Kelley
* test runner is improved to respect `error.SkipZigTest` * start code is improved to `@setAlignStack(16)` before calling main() * the newly passing behavior test has a workaround for the fact that stage2 cannot yet call `std.Target.x86.featureSetHas()` at comptime. This is blocking on comptime closures. The workaround is that there is a new decl `@import("builtin").stage2_x86_cx16` which is a `bool`. * Implement `@setAlignStack`. This language feature should be re-evaluated at some point - I'll file an issue for it. * LLVM backend: apply/remove the cold attribute and noinline attribute where appropriate. * LLVM backend: loads and stores are properly annotated with alignment and volatile attributes. * LLVM backend: allocas are properly annotated with alignment. * Type: fix integers reporting wrong alignment for 256-bit integers and beyond. Once you get to 16 byte aligned, there is no further alignment for larger integers.
2021-09-01std: fix regressions from this branchAndrew Kelley
Also move some usingnamespace test cases from compare_output to behavior.
2021-08-28AstGen: pre-scan all decls in a namespaceAndrew Kelley
Also: * improve the "ambiguous reference" error by swapping the order of "declared here" and "also declared here" notes. * improve the "not accessible from inner function" error: - point out that it has to do with the thing being mutable - eliminate the incorrect association with it being a function - note where it crosses a namespace boundary * struct field types are evaluated in a context that has the struct namespace visible. Likewise with align expressions, linksection expressions, enum tag values, and union/enum tag argument expressions. Closes #9194 Closes #9622
2021-08-24fix stage2 test cases expecting wrong line numbersAndrew Kelley
Previous commit shifted everything down in the start.zig file, and unfortunately our stage2 test harness depends on absolute line numbers for a couple tests.
2021-08-19stage2 x86_64: enable bitwise and + or and add testsJacob G-W
2021-08-19stage2: add error set type equalityJacob G-W
2021-08-13Merge pull request #9227 from mathetake/libc-wasi-testJakub Konka
WASI,libc: fix libstd with wasi-libc linkage, and enable tests.
2021-08-12Merge pull request #9166 from joachimschmidt557/stage2Andrew Kelley
stage2 Sema: Add error notes to unresolvable peer types
2021-08-09Merge remote-tracking branch 'origin' into libc-wasi-testTakeshi Yoneda
2021-08-04stage2 generics improvements: anytype and param type exprsAndrew Kelley
AstGen result locations now have a `coerced_ty` tag which is the same as `ty` except it assumes that Sema will do a coercion, so it does not redundantly add an `as` instruction into the ZIR code. This results in cleaner ZIR and about a 14% reduction of ZIR bytes. param and param_comptime ZIR instructions now have a block body for their type expressions. This allows Sema to skip evaluation of the block in the case that the parameter is comptime-provided. It also allows a new mechanism to function: when evaluating type expressions of generic functions, if it would depend on another parameter, it returns `error.GenericPoison` which bubbles up and then is caught by the param/param_comptime instruction and then handled. This allows parameters to be evaluated independently so that the type info for functions which have comptime or anytype parameters will still have types populated for parameters that do not depend on values of previous parameters (because evaluation of their param blocks will return successfully instead of `error.GenericPoison`). It also makes iteration over the block that contains function parameters slightly more efficient since it now only contains the param instructions. Finally, it fixes the case where a generic function type expression contains a function prototype. Formerly, this situation would cause shared state to clobber each other; now it is in a proper tree structure so that can't happen. This fix also required adding a field to Sema `comptime_args_fn_inst` to make sure that the `comptime_args` field passed into Sema is applied to the correct `func` instruction. Source location for `node_offset_asm_ret_ty` is fixed; it was pointing at the asm output name rather than the return type as intended. Generic function instantiation is fixed, notably with respect to parameter type expressions that depend on previous parameters, and with respect to types which must be always comptime-known. This involves passing all the comptime arguments at a callsite of a generic function, and allowing the generic function semantic analysis to coerce the values to the proper types (since it has access to the evaluated parameter type expressions) and then decide based on the type whether the parameter is runtime known or not. In the case of explicitly marked `comptime` parameters, there is a check at the semantic analysis of the `call` instruction. Semantic analysis of `call` instructions does type coercion on the arguments, which is needed both for generic functions and to make up for using `coerced_ty` result locations (mentioned above). Tasks left in this branch: * Implement the memoization table. * Add test coverage. * Improve error reporting and source locations for compile errors.
2021-08-04stage2 Sema: Resolve LazySrcLocs for bitwise and arithmetic exprsjoachimschmidt557
2021-08-04stage2 Sema: Resolve source locations of @TypeOf parametersjoachimschmidt557
2021-07-29stage2: more principled approach to comptime referencesAndrew Kelley
* AIR no longer has a `variables` array. Instead of the `varptr` instruction, Sema emits a constant with a `decl_ref`. * AIR no longer has a `ref` instruction. There is no longer any instruction that takes a value and returns a pointer to it. If this is desired, Sema must either create an anynomous Decl and return a constant `decl_ref`, or in the case of a runtime value, emit an `alloc` instruction, `store` the value to it, and then return the `alloc`. * The `ref_val` Value Tag is eliminated. `decl_ref` should be used instead. Also added is `eu_payload_ptr` which points to the payload of an error union, given an error union pointer. In general, Sema should avoid calling `analyzeRef` if it can be helped. For example in the case of field_val and elem_val, there should never be a reason to create a temporary (alloc or decl). Recent previous commits made progress along that front. There is a new abstraction in Sema, which looks like this: var anon_decl = try block.startAnonDecl(); defer anon_decl.deinit(); // here 'anon_decl.arena()` may be used const decl = try anon_decl.finish(ty, val); // decl is typically now used with `decl_ref`. This pattern is used to upgrade `ref_val` usages to `decl_ref` usages. Additional improvements: * Sema: fix source location resolution for calling convention expression. * Sema: properly report "unable to resolve comptime value" for loads of global variables. There is now a set of functions which can be called if the callee wants to obtain the Value even if the tag is `variable` (indicating comptime-known address but runtime-known value). * Sema: `coerce` resolves builtin types before checking equality. * Sema: fix `u1_type` missing from `addType`, making this type have a slightly more efficient representation in AIR. * LLVM backend: fix `genTypedValue` for tags `decl_ref` and `variable` to properly do an LLVMConstBitCast. * Remove unused parameter from `Value.toEnum`. After this commit, some test cases are no longer passing. This is due to the more principled approach to comptime references causing more anonymous decls to get sent to the linker for codegen. However, in all these cases the decls are not actually referenced by the runtime machine code. A future commit in this branch will implement garbage collection of decls so that unused decls do not get sent to the linker for codegen. This will make the tests go back to passing.
2021-07-27WASI,libc: enable tests.Takeshi Yoneda
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-07-14astgen: errors for shadowing in if capturesJacob G-W
2021-07-14astgen: errors for shadowing in loop capturesJacob G-W
2021-07-11Merge pull request #9352 from g-w1/fix-9346Andrew Kelley
stage2 astgen: error for return outside of function scope
2021-07-11stage2: remove redundancy from error messageJacob G-W
invalid 'try' outside function scope -> 'try' outside function scope
2021-07-09plan9 codegen, add testsJacob G-W
They generate an object file, but do not execute yet, since we don't have something to execute them with.
2021-07-08stage2 astgen: provide 3 more errors for invalid inline assemblyJacob G-W