50 Commits

Author SHA1 Message Date
mlugg
d60910c9d0
incremental: add ZON test 2025-02-04 16:20:30 +00:00
Matthew Lugg
3767b08039
Merge pull request #22602 from mlugg/incr-embedfile
incremental: handle `@embedFile`
2025-01-26 01:41:56 +00:00
mlugg
fcf8d5ada2
incr-check: check compile errors against expected
Also modifies all incremental cases using `#expect_error` to include the
errors and notes which are expected.
2025-01-25 09:32:40 +00:00
mlugg
f47b8de2ad
incremental: handle @embedFile
Uses of `@embedFile` register dependencies on the corresponding
`Zcu.EmbedFile`. At the start of every update, we iterate all embedded
files and update them if necessary, and invalidate the dependencies if
they changed.

In order to properly integrate with the lazy analysis model, failed
embed files are now reported by the `AnalUnit` which actually used
`@embedFile`; the filesystem error is stored in the `Zcu.EmbedFile`.

An incremental test is added covering incremental updates to embedded
files, and I have verified locally that dependency invalidation is
working correctly.
2025-01-25 06:07:08 +00:00
mlugg
5a6666db55
all: update for panic.unwrapError and panic.call signature changes 2025-01-24 22:33:23 +00:00
mlugg
83991efe10
compiler: yet more panic handler changes
* `std.builtin.Panic` -> `std.builtin.panic`, because it is a namespace.
* `root.Panic` -> `root.panic` for the same reason. There are type
  checks so that we still allow the legacy `pub fn panic` strategy in
  the 0.14.0 release.
* `std.debug.SimplePanic` -> `std.debug.simple_panic`, same reason.
* `std.debug.NoPanic` -> `std.debug.no_panic`, same reason.
* `std.debug.FormattedPanic` is now a function `std.debug.FullPanic`
  which takes as input a `panicFn` and returns a namespace with all the
  panic functions. This handles the incredibly common case of just
  wanting to override how the message is printed, whilst keeping nice
  formatted panics.
* Remove `std.builtin.panic.messages`; now, every safety panic has its
  own function. This reduces binary bloat, as calls to these functions
  no longer need to prepare any arguments (aside from the error return
  trace).
* Remove some legacy declarations, since a zig1.wasm update has
  happened. Most of these were related to the panic handler, but a quick
  grep for "zig1" brought up a couple more results too.

Also, add some missing type checks to Sema.

Resolves: #22584

formatted -> full
2025-01-24 19:29:51 +00:00
mlugg
f7b9f84df2
incremental: fix enum resolution bugs 2025-01-18 14:30:06 +00:00
Jacob Young
257054a146 Revert "disable flaky incremental compilation tests"
This reverts commit 133abdeda2994886c3476a3faf53f8a911513b32 but keeps
the tests disabled for the wasm target, which is the only configuration
that seems to fail, even though the error looks like a frontend error.
2025-01-16 20:02:49 -05:00
Andrew Kelley
133abdeda2 disable flaky incremental compilation tests
tracking issue #22510
2025-01-16 13:13:11 -08:00
Andrew Kelley
9285f91ccc wasm linker: incremental test coverage 2025-01-15 15:11:36 -08:00
Jacob Young
dde3116e50
Dwarf: implement new incremental line number update API 2025-01-05 02:20:56 +00:00
mlugg
6cc848e9f6
incremental: add new test cases
These cover the fixes from the last few commits.
2025-01-04 07:51:19 +00:00
mlugg
f0d5e0df4d
incremental: fix errors not being deleted upon re-analysis
Previously, logic in `Compilation.getAllErrorsAlloc` was corrupting the
`failed_analysis` hashmap. This meant that on updates after the initial
update, attempts to remove entries from this map (because the `AnalUnit`
in question is being re-analyzed) silently failed. This resulted in
compile errors from earlier updates wrongly getting "stuck", i.e. never
being removed.

This commit also adds a few log calls which helped me to find this bug.
2025-01-01 15:49:37 +00:00
Jacob Young
11e54a3559 link: fix failing incremental test cases 2024-11-16 14:03:31 -05:00
mlugg
6e56bc1096
test: add new incremental case
This is similar to the old `llvm/shift_right_plus_left` case, which was
disabled by 1b1c78c. The case is not enabled on the LLVM backend, since
incremental compilation support for this backend is a work in progress
and is tracked by #21165. It passes on the x86_64-linux target with the
self-hosted backend.

Resolves: #12288
2024-11-11 12:22:55 +00:00
mlugg
ca12e4f33e
test: remove old-style incremental cases, add a few new incremental cases
These cases have been disabled for a while, and we have transitioned to
using a compact file format for incremental test cases.

I was originally planning to port all of these cases, but the vast
majority aren't testing anything interesting, so it wasn't worth the
effort. I did look through each one; anything interesting being tested
has been extracted into a new case in `test/incremental/`.

Two of the new tests are currently failing with the self-hosted ELF
linker, and thus are currently only enabled with the C backend.

Resolves: #12844
2024-11-11 12:22:48 +00:00
mlugg
8573836892
incremental: disable flaky test 2024-10-18 09:46:03 +01:00
mlugg
3ba4f86198
incremental: disable failing test
The previous commit exposed a linker bug.
2024-10-16 16:30:38 +01:00
mlugg
22539783ad
incremental: introduce file dependencies to handle AstGen failures
The re-analysis here is a little coarse; it'd be nice in the future to
have a way for an AstGen failure to preserve *all* analysis which
depends on the last success, and just hide the compile errors which
depend on it somehow. But I'm not sure how we'd achieve that, so this
works fine for now.

Resolves: #21223
2024-10-16 16:30:36 +01:00
mlugg
a7dd34bfc5
incremental: add new test case
This isn't exactly the case provided in #11290, but is a slightly
simpler case which I know would have triggered the same bug in the old
implementation of incremental compilation.

Resolves: #11290
2024-10-16 14:22:33 +01:00
mlugg
14ccbbef9f
test: add x86_64-windows-cbe target to incremental cases
Throw another target in there just to spice things up a little!

Running the incremental cases with the C backend is pretty slow due to
the need to recompile the whole output from scratch on every update; for
this reason, we probably don't want to keep many of these targeting CBE
long-term. However, for now, while we have relatively few tests and
things are still changing quite a lot, it's better to have this little
bit of extra test coverage.
2024-10-05 20:52:26 +01:00
mlugg
054dbb6798
incr-check: specify backend in manifest, allow multiple targets/backends 2024-09-25 20:39:31 +01:00
mlugg
7d54c62c8a incremental: fix adding/removing aggregate fields
I don't recall why I put these checks here -- they aren't correct. We
can freely recreate a type even if its fields have changed, because we
are going to re-do all type resolution.

The only conditions for recreations are (a) the ZIR index must not be
lost and (b) the number of captures must be the same. These conditions
are permissible because if either is violated, we can guarantee that
analysis of a valid `zirStructDecl` (etc) will never reference this
type (since the ZIR index has just been tracked, and the captures have
just been created based on the ZIR).

Adds a corresponding test case.

Resolves: #21185
2024-08-24 20:30:52 +01:00
mlugg
a99ad52b36
Sema: register correct dependencies for inline calls
And add a corresponding test case.
2024-08-21 01:30:46 +01:00
mlugg
2fb78430db
test: remove accidental hard tab 2024-08-21 01:30:46 +01:00
mlugg
ceb76b2ba7
test: add incremental compilation test for moving @src() call 2024-08-21 01:30:46 +01:00
mlugg
a239d8d4e2
test: add incremental case 2024-08-18 18:10:59 +01:00
mlugg
1ccbc6ca20 test: add new incremental test
This case is adapted from #11344, and passes with `-fno-emit-bin`.

Resolves: #11344
2024-08-17 18:50:10 -04:00
mlugg
936a79f428 tools,test: improve incr-check and add new incremental tests 2024-08-17 18:50:10 -04:00
mlugg
b65865b027 tools: improve incr-check
And add a new incremental test to match!
2024-08-17 18:50:10 -04:00
Andrew Kelley
9f112ce868 incr-test: running an update 2024-07-20 01:06:29 -07:00
Andrew Kelley
ea2c45227a init incremental compilation check tool 2024-07-20 01:06:29 -07:00
Jakub Konka
3624e1ef48 test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
Andrew Kelley
1a1f62a0ce std: enable real start code always for LLVM backend 2022-05-02 22:06:02 -07:00
Veikka Tuominen
a6f254ec3e stage2: fix comptime unreachable 2022-04-30 01:05:48 +03:00
Jakub Konka
3c19f694d9 test: fix incorrect error loc in assert_function x86_64-linux test 2022-04-28 18:35:01 +02:00
Jakub Konka
2875216f8e test: fix x86_64-macos failures
This is just a temporary fix - I would like to unify all of x86_64
tests across linux and macos OSes.
2022-04-28 18:35:01 +02:00
Jakub Konka
5a5648c0f0 test: migrate llvm incremental tests 2022-04-28 18:35:01 +02:00
Jakub Konka
495bb12e6a test: migrate plan9 and sparcv9 incremental tests 2022-04-28 18:35:01 +02:00
Jakub Konka
ed51a5d02a test: migrate arm incremental tests 2022-04-28 18:35:01 +02:00
Jakub Konka
fc4fbfe8e1 test: migrate aarch64 incremental tests 2022-04-28 18:35:01 +02:00
Jakub Konka
7e17cbbda5 test: migrate riscv64 incremental tests 2022-04-28 18:35:01 +02:00
Jakub Konka
8e05e6a1ed test: migrate wasm incremental tests 2022-04-28 18:35:01 +02:00
Jakub Konka
8d5acf7693 test: recursively walk dir with tests
Prune incremental tests by moving non-incremental behavior tests to
behavior test suite instead.
2022-04-28 18:35:01 +02:00
Jakub Konka
97b781955e test: fix incorrect default target spec; port all incremental tests 2022-04-28 18:35:01 +02:00
Jakub Konka
0998185f77 test: adjust error location for assert_function test 2022-04-28 18:35:01 +02:00
Jakub Konka
c1a98cd65d test: set case name from initial filename for a sequence
Port more incremental tests.
2022-04-28 18:35:01 +02:00
Jakub Konka
46db5e2a44 test: unroll into multiple cases, provide default parsers
Provide default parsers for obvious config options such as
`CrossTarget` or `Backend` (or any enum for that matter).

Unroll iterator loops into multiple cases - we need to create
a Cartesian product for all possibilities specified in the
test manifest.
2022-04-28 18:35:01 +02:00
Jakub Konka
f41dd3617e test: pass Strategy per directory of tests 2022-04-28 18:35:01 +02:00
Jakub Konka
d8d12d51ec test: abstract away test manifest parser into separate struct 2022-04-28 18:35:01 +02:00