aboutsummaryrefslogtreecommitdiff
path: root/test/tests.zig
AgeCommit message (Collapse)Author
2021-07-02avoid calling into stage1 backend when AstGen failsAndrew Kelley
The motivation for this commit is that there exists source files which produce ast-check errors, but crash stage1 or otherwise trigger stage1 bugs. Previously to this commit, Zig would run AstGen, collect the compile errors, run stage1, report stage1 compile errors and exit if any, and then report AstGen compile errors. The main change in this commit is to report AstGen errors prior to invoking stage1, and in fact if any AstGen errors occur, do not invoke stage1 at all. This caused most of the compile error tests to fail due to things such as unused local variables and mismatched stage1/stage2 error messages. It was taking a long time to update the test cases one-by-one, so I took this opportunity to unify the stage1 and stage2 testing harness, specifically with regards to compile errors. In this way we can start keeping track of which tests pass for 1, 2, or both. `zig build test-compile-errors` no longer works; it is now integrated into `zig build test-stage2`. This is one step closer to executing compile error tests in parallel; in fact the ThreadPool object is already in scope. There are some cases where the stage1 compile errors were actually better; those are left failing in this commit, to be addressed in a follow-up commit. Other changes in this commit: * build.zig: improve support for -Dstage1 used with the test step. * AstGen: minor cosmetic changes to error messages. * stage2: add -fstage1 and -fno-stage1 flags. This now allows one to download a binary of the zig compiler and use the llvm backend of self-hosted. This was also needed for hooking up the test harness. However, I realized that stage1 calls exit() and also has memory leaks, so had to complicate the test harness by not using this flag after all and instead invoking as a child process. - These CLI flags will disappear once we start shipping the self-hosted compiler as the main compiler. Until then, they can be used to try out the work-in-progress stage2. * stage2: select the LLVM backend by default for release modes, as long as the target architecture is supported by LLVM. * test harness: support setting the optimize mode
2021-06-21fix code broken from previous commitJacob G-W
2021-06-21std, src, doc, test: remove unused variablesJacob G-W
2021-06-13format zig files and add formatting check to cijacob gw
2021-06-12std.build: don't default to static linkageVeikka Tuominen
2021-06-11make remaining enums in build.zig snake_caseVeikka Tuominen
2021-06-11Changes to .path instead of .getPathFn. Changes LibExeObjStep to also ↵Felix (xq) Queißner
provide FileSource.
2021-06-11Changes createExecutable parameter is_dynamic to a enum to make code more ↵Felix (xq) Queißner
readable .
2021-06-06Revert "tests: disable i386-linux-gnu -lc target due to CI failures"LemonBoy
This reverts commit 97a2f4e7ae9c52c595841347bb0b26572b180dcf.
2021-05-28tests: disable i386-linux-gnu -lc target due to CI failuresAndrew Kelley
See #8930
2021-05-25standalone tests may now test cross targets and build modes.xavier
2021-05-15Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * build.zig * src/Compilation.zig * src/codegen/spirv/spec.zig * src/link/SpirV.zig * test/stage2/darwin.zig - this one might be problematic; start.zig looks for `main` in the root source file, not `_main`. Not sure why there is an underscore there in master branch.
2021-05-13Add experimental Darling support for cross testing macOSJakub Konka
* for cross testing stage2 tests, we use `darling shell` command since the path to the tested binary is relative to cwd * for the `zig test` command, we simply use `darling` since the path to the binary is absolute
2021-05-12Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * lib/std/os/linux.zig * lib/std/os/windows/bits.zig * src/Module.zig * src/Sema.zig * test/stage2/test.zig Mainly I wanted Jakub's new macOS code for respecting stack size, since we now depend on it for debug builds able to pass one of the test cases for recursive comptime function calls with `@setEvalBranchQuota`. The conflicts were all trivial.
2021-05-11test: Enable i386-linux-gnu testLemonBoy
This is needed to catch any possible problem with executables linking to 32bit glibc.
2021-04-24Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
In particular I wanted the change that makes `suspend;` illegal in the parser.
2021-04-21test: Add 32bit PowerPC to the test planLemonBoy
Since MIPS is temporarily out of order due to some issues with LLD let's add PPC32 to have at least one big-endian platform in the testing plan.
2021-04-15fix new references to std.builtin that should have been std.TargetAndrew Kelley
2021-04-15stage2: improvements aimed at std lib integrationAndrew Kelley
* AstGen: emit decl lookup ZIR instructions rather than directly looking up decls in AstGen. This is necessary because we want to reuse the same immutable ZIR code for multiple generic instantiations (and comptime function calls). * AstGen: fix using members_len instead of fields_len for struct decls. * structs: the struct_decl ZIR instruction is now also a block. This is so that the type expressions, default field value expressions, and alignment expressions can be evaluated in a scope that contains the decls from the struct namespace itself. * Add "std" and "builtin" packages to the builtin package. * Don't try to build glibc, musl, or mingw-w64 when using `-ofmt=c`. * builtin.zig is generated without `usingnamespace`. * builtin.zig takes advantage of `std.zig.fmtId` for CPU features. * A first pass at implementing `usingnamespace`. It's problematic and should either be deleted, or polished, before merging this branch. * Sema: allow explicitly specifying the namespace in which to look up Decls. This is used by `struct_decl` in order to put the decls from the struct namespace itself in scope when evaluating the type expressions, default value expressions, and alignment expressions. * Module: fix `analyzeNamespace` assuming that it is the top-level root declaration node. * Sema: implement comptime and runtime cmp operator. * Sema: implement peer type resolution for enums and enum literals. * Pull in the changes from master branch: 262e09c482d98a78531c049a18b7f24146fe157f. * ZIR: complete out simple_ptr_type debug printing
2021-04-11Merge remote-tracking branch 'origin/master' into llvm12Michael Dusan
2021-04-10test: overhaul stack_trace testingMichael Dusan
- limit expected-output to main source file; ie. tolerate changes to start.zig - when mode != .Debug the function name is now symbolically represented; ie. tolerate changes in llvm optimizer effects on the callstack - cleanup how test cases are specified - add test case predicates for excluding by arch, os or custom fn
2021-04-02disable failing MIPS tests due to LLVM12 regressionsAndrew Kelley
See #8155
2021-01-30Replace @TagType uses, mostly with std.meta.TagTadeo Kondrak
2021-01-07Reduce use of deprecated IO typesJay Petacat
Related: #4917
2021-01-02tests: Use {s} instead of {} when formatting stringsLemonBoy
2020-12-08tests: run-translated-c now respects -DtargetAndrew Kelley
2020-10-12Rename .macosx to .macosVignesh Rajagopalan
2020-09-26fix another round of regressions in this branchAndrew Kelley
* std.log: still print error messages in ReleaseSmall builds. - when start code gets an error code from main, it uses std.log.err to report the error. this resulted in a test failure because ReleaseSmall wasn't printing `error: TheErrorCode` when an error was returned from main. But that seems like it should keep working. So I changed the std.log defaults. I plan to follow this up with a proposal to change the names of and reduce the quantity of the log levels. * warning emitted when using -femit-h when using stage1 backend; fatal log message when using -femit-h with self-hosted backend (because the feature is not yet available) * fix double `test-cli` build steps in zig's build.zig * update docgen to use new CLI * translate-c uses `-x c` and generates a temporary basename with a `.h` extension. Otherwise clang reports an error. * --show-builtin implies -fno-emit-bin * restore the compile error for using an extern "c" function without putting -lc on the build line. we have to know about the libc dependency up front. * Fix ReleaseFast and ReleaseSmall getting swapped when passing the value to the stage1 backend. * correct the zig0 CLI usage text. * update test harness code to the new CLI.
2020-07-16add behavior tests fro macro translationsVexu
2020-06-09fix memory errorsJonathan Marler
2020-05-25Added custom build step id, made tests.zig steps use itAlexandros Naskos
2020-05-18Narrow down behaviour test cases; this removes wasmtime-enabled check in testsJakub Konka
2020-05-18Disable tests requiring Wasmtime be default; require -Denable-wasmtime flag ↵Jakub Konka
otherwise
2020-05-18Add/fix missing WASI functionality to pass libstd testsJakub Konka
This rather large commit adds/fixes missing WASI functionality in `libstd` needed to pass the `libstd` tests. As such, now by default tests targeting `wasm32-wasi` target are enabled in `test/tests.zig` module. However, they can be disabled by passing the `-Dskip-wasi=true` flag when invoking the `zig build test` command. When the flag is set to `false`, i.e., when WASI tests are included, `wasmtime` with `--dir=.` is used as the default testing command. Since the majority of `libstd` tests were relying on `fs.cwd()` call to get current working directory handle wrapped in `Dir` struct, in order to make the tests WASI-friendly, `fs.cwd()` call was replaced with `testing.getTestDir()` function which resolved to either `fs.cwd()` for non-WASI targets, or tries to fetch the preopen list from the WASI runtime and extract a preopen for '.' path. The summary of changes introduced by this commit: * implement `Dir.makeDir` and `Dir.openDir` targeting WASI * implement `Dir.deleteFile` and `Dir.deleteDir` targeting WASI * fix `os.close` and map errors in `unlinkat` * move WASI-specific `mkdirat` and `unlinkat` from `std.fs.wasi` to `std.os` module * implement `lseek_{SET, CUR, END}` targeting WASI * implement `futimens` targeting WASI * implement `ftruncate` targeting WASI * implement `readv`, `writev`, `pread{v}`, `pwrite{v}` targeting WASI * make sure ANSI escape codes are _not_ used in stderr or stdout in WASI, as WASI always sanitizes stderr, and sanitizes stdout if fd is a TTY * fix specifying WASI rights when opening/creating files/dirs * tweak `AtomicFile` to be WASI-compatible * implement `os.renameatWasi` for WASI-compliant `os.renameat` function * implement sleep() targeting WASI * fix `process.getEnvMap` targeting WASI
2020-04-24Add mips support to standard libraryTimon Kruiper
2020-04-11ArrayList: remove old (before span) APIxackus
2020-04-08fix missing compile error on assign to slice and array parametersVexu
2020-04-04rename mem.separate to mem.splitxackus
2020-04-03Merge pull request #4868 from xackus/new-arraylist-apiAndrew Kelley
new ArrayList API
2020-04-03add issue links to disabled test casesAndrew Kelley
2020-04-03change the default ABI of riscv64-linux-muslAndrew Kelley
Before, this would cause a link failure when mixing Zig and C code for RISC-V targets. Now, the ABIs match and Zig and C code can be mixed successfully. I will file a follow-up issue for the ability to deal more explicitly with ABIs. closes #4863
2020-04-02ci: enable riscv64-linux testsAndrew Kelley
Thanks to Michael Dusan's work in deef063bbf these tests can be enabled.
2020-04-02new ArrayList API: fix everything elsexackus
2020-04-01(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)Andrew Kelley
This new name (and the fact that it is a function returning a type) will make it more clear which use cases are better suited for ArrayList and which are better suited for ArrayListSentineled. Also for consistency with ArrayList, * `append` => `appendSlice` * `appendByte` => `append` Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-03-30std lib API deprecations for the upcoming 0.6.0 releaseAndrew Kelley
See #3811
2020-03-22ci: disable qemu-riscv64 tests due to qemu being too oldAndrew Kelley
2020-03-13Merge remote-tracking branch 'origin/master' into llvm10Andrew Kelley
2020-03-10fix regressions found by test suiteAndrew Kelley
2020-03-07Merge remote-tracking branch 'origin/master' into llvm10Andrew Kelley
2020-03-06Use in_stream.readAllAlloc where sensibledaurnimator