Commit Graph

384 Commits

Author SHA1 Message Date
Alex Rønne Petersen
6302a90cbf
test: Add riscv(32,64)-linux-(none,musl) with soft float to module tests. 2024-10-15 20:25:26 +02:00
mlugg
f60c045cef
tests: add test-incremental step
This is contained in the `test` step, so is tested by CI.

This commit also includes some enhancements to the `incr-check` tool to
make this work correctly.
2024-10-05 20:52:25 +01:00
Alex Rønne Petersen
736694b1e6
test: Add s390x-linux-(none,musl,gnu) triples to module tests. 2024-10-04 00:26:55 +02:00
Alex Rønne Petersen
496e90a487
test: Add riscv32-linux-(none,musl,gnu) triples for module tests. 2024-09-20 13:03:33 +02:00
Alex Rønne Petersen
8c0902b7ae Revert "tests: skip native CPU std tests on Windows"
This reverts commit 234693bcbb.
2024-09-19 18:20:21 -07:00
Alex Rønne Petersen
2a24c17be2 test: Re-enable LLVM riscv64 module tests.
Closes #18872.
2024-09-19 18:20:21 -07:00
Alex Rønne Petersen
75983c692f
test: Switch all arm-linux-* triples for module tests from v8a to v7a.
Broadly speaking, versions 6, 7, and 8 are the ones that are in common use. Of
these, v7 is what you'll typically see for 32-bit Arm today. So let's actually
make sure that that's what we're testing.
2024-09-10 08:53:30 +02:00
Alex Rønne Petersen
a872b61021
test: Add arm, mips, and powerpc soft float targets to module tests.
Prefer `eabi` and `eabihf` over the ambiguous `none` when not using libc.
2024-09-10 08:53:30 +02:00
Alex Rønne Petersen
17f54e8274
std.zig.target: Split powerpc-linux-musl triple into powerpc-linux-musleabi(hf). 2024-09-06 20:11:47 +02:00
Alex Rønne Petersen
c1a70acc91
std.zig.target: Split mips(el)-linux-musl triples into mips(el)-linux-musleabi(hf).
Closes #21184.
2024-09-06 20:11:47 +02:00
Alex Rønne Petersen
ee3efe8007
test: Add powerpc64-linux-(none,musl) triples to module tests. 2024-09-05 01:15:33 +02:00
Alex Rønne Petersen
3e8ac8e23f test: Add mips64(el)-linux-(none,musl,gnuabi64) targets.
These take 3-4 minutes to run on my machine, i.e. they're not affected by the
LLVM compilation speed bug that affects mips32.
2024-08-18 07:27:23 +02:00
Jacob Young
ef11bc9899 Dwarf: rework self-hosted debug info from scratch
This is in preparation for incremental and actually being able to debug
executables built by the x86_64 backend.
2024-08-16 15:22:55 -04:00
Alex Rønne Petersen
b6009a7416
build/test: Add -Dtest-slow-targets and move mips module tests behind it.
The idea is that these tests are just too slow to include by default on a
contributor's local machine. If they want to run these, they need to opt in.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen
3b51b43dc8
build/test: Add -Dtest-target-filter for filtering module tests by target triple.
This is useful during porting work where you're not interested in running all
targets all the time while iterating on changes.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen
019c0fc184
test: Re-enable mips(el)-linux-gnueabihf tests.
Closes #4927.
2024-08-14 06:52:05 +02:00
Andrew Kelley
0b5ea2b902
Merge pull request #21053 from alexrp/mips-tests
`test`: Re-enable `mips(el)-linux(-musl)` tests.
2024-08-13 11:48:33 -07:00
Alex Rønne Petersen
eadc0c01cc test: Re-enable armv8-linux-gnueabihf tests.
Closes #3287.
2024-08-13 00:57:49 -07:00
Alex Rønne Petersen
46f64358dd
test: Re-enable mips(el)-linux(-musl) tests.
Closes #13782.
Closes #16846.
2024-08-12 13:34:19 +02:00
Andrew Kelley
9c84b5cc18 build.zig: fix -Dskip-non-native
now it actually does what it says on the tin
2024-08-01 13:47:29 -07:00
David Rubin
93e9c7a963
riscv: implement @clz 2024-07-26 04:05:39 -07:00
David Rubin
571aa694fd
riscv: vectors part 1 2024-07-14 23:02:34 -07:00
Andrew Kelley
d1c14f2f52 std.Build.Step.WriteFile: extract UpdateSourceFiles
This has been planned for quite some time; this commit finally does it.

Also implements file system watching integration in the make()
implementation for UpdateSourceFiles and fixes the reporting of step
caching for both.

WriteFile does not yet have file system watching integration.
2024-07-12 00:14:08 -07:00
Andrew Kelley
0cc492a272 make more build steps integrate with the watch system 2024-07-12 00:14:08 -07:00
mlugg
0e5335aaf5
compiler: rework type resolution, fully resolve all types
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-04 21:01:42 +01:00
Jonathan Marler
d9f1a952b8 build: fix WriteFile and addCSourceFiles not adding LazyPath deps
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-07-04 13:34:17 -04:00
Krzysztof Wolicki
45c77931c2 Change deprecated b.host to b.graph.host in tests and Zig's build.zig 2024-06-13 10:49:06 -04:00
Veikka Tuominen
c01d8c8b20 pass -fno-builtin when testing lib/c.zig, lib/compiler_rt.zig 2024-06-02 10:10:35 +03:00
David Rubin
d9e0cafe64 riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
Ryan Liptak
b86c4bde64 Rename Dir.writeFile2 -> Dir.writeFile and update all callsites
writeFile was deprecated in favor of writeFile2 in f645022d16. This commit renames writeFile2 to writeFile and makes writeFile2 a compile error.
2024-05-03 13:29:22 -07:00
Andrew Kelley
dddddcffd0 disable RISC-V CI testing due to LLVM's O(N^2) codegen
tracked by #18872
2024-04-19 20:24:57 -07:00
Jacob Young
f1c0f42cdd cbe: fix optional codegen
Also reduce ctype pool string memory usage, remove self assignments, and
enable more warnings.
2024-04-13 01:35:20 -04:00
Andrew Kelley
b30ad74908 remove deprecated LazyPath.path union tag 2024-04-11 14:02:47 -07:00
Carl Åstholm
5d5e89aa8d Promote linker test cases to packages 2024-04-07 16:05:54 -07:00
Carl Åstholm
33b8fdb6bc Turn "simple" standalone test cases into a package 2024-04-07 16:05:54 -07:00
Carl Åstholm
c3ecc6972e Don't add standalone test cases until we've built stage3 2024-04-07 16:05:54 -07:00
Carl Åstholm
3ed221f149 Promote standalone test cases to packages
This is a prerequisite for removing `b.anonymousDependency()`, but
having compiler tests dogfood package management might be a good idea
in general.
2024-04-07 16:05:53 -07:00
Jacob Young
5a41704f7e cbe: rewrite CType
Closes #14904
2024-03-30 20:50:48 -04:00
february cozzocrea
b2427ea7d8 test manifest key checking and other fixes
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-03-08 02:59:45 -08:00
Andrew Kelley
d51aa9748f change default WASI stack size
to match the other operating systems. 16 MiB

closes #18885
2024-02-26 10:33:17 -08:00
Jacob Young
d656c2a7ab test: rework how filtering works
* 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-25 19:12:08 -08:00
Jacob Young
31763d28c4 Revert "tests: add -Dskip-cross-glibc option"
This reverts commit bc0f246911.

This was added as a workaround for a bug that has since been fixed.
2024-02-24 23:23:15 +01:00
Jacob Young
2291560424 c_import: extract behavior tests that use @cImport
This introduces the new test step `test-c-import`, and removes the
ability of the behavior tests to `@cImport` paths relative to `test`.
This allows the behavior tests to be run without translate c.
2024-02-20 18:44:43 +01:00
Andrew Kelley
105db13536 std.Build: implement --host-target, --host-cpu, --host-dynamic-linker
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-02 20:43:01 -07:00
Jakub Konka
d93a0763d4 test/link/link: pass build options to elf and macho tests 2024-01-24 12:34:39 +01:00
Andrew Kelley
b92e30ff0b std.Build.ResolvedTarget: rename target field to result
This change is seemingly insignificant but I actually agonized over this
for three days. Some other things I considered:

* (status quo in master branch) make Compile step creation functions
  accept a Target.Query and delete the ResolvedTarget struct.
  - downside: redundantly resolve target queries many times
* same as before but additionally add a hash map to cache target query
  resolutions.
  - downside: now there is a hash map that doesn't actually need to
    exist, just to make the API more ergonomic.
* add is_native_os and is_native_abi fields to std.Target and use it
  directly as the result of resolving a target query.
  - downside: they really don't belong there. They would be available
    as comptime booleans via `@import("builtin")` but they should not
    be exposed that way.

With this change the downsides are:
* the option name of addExecutable and friends is `target` instead of
  `resolved_target` matching the type name.
  - upside: this does not break compatibility with existing build
    scripts
* you likely end up seeing `target.result.cpu.arch` rather than
  `target.cpu.arch`.
  - upside: this is an improvement over `target.target.cpu.arch` which
    it was before this commit.
  - downside: `b.host.target` is now `b.host.result`.
2024-01-01 17:51:18 -07:00
Andrew Kelley
8c44954bc6 std.Target.Query: remove deprecated API
These functions have been doomed for a long time. Finally I figured out
what the proper relationship between this API and std.Target is.
2024-01-01 17:51:18 -07:00
Andrew Kelley
3179f58c41 rename std.zig.CrossTarget to std.Target.Query 2024-01-01 17:51:18 -07:00
Andrew Kelley
142471fcc4 zig build system: change target, compilation, and module APIs
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.
2024-01-01 17:51:18 -07:00
Jacob Young
bf5ab54510 test: test with -fstrip and fix failures
Closes #17513
2023-12-01 04:34:50 +00:00