This adds a standalone test case to ensure the runtime does not trap
when performing a memory.copy or memory.fill instruction while the
destination or source address is out-of-bounds and the length is 0.
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:
* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
Make to avoid releasing request's connection twice.
Change the `Request.connection` field optional. This field is null while the connection is released.
Fixes#15965
On Windows, a directory that's set as the current working directory is
not allowed to be removed. This can cause error on `deleteTree` if the
CWD is set to the file to be removed and will cause `error.FileBusy`.
However, due to `tmp.cleanup()` ignoring the errors, the folder removal error will
be ignored. The only test violating this is `windows_spawn`. As a
solution, setting the parent directory to be the CWD before deletion
will allow the cleanup to pass.
* remove setName, setFilter, and setTestRunner. Please set these
options directly when creating the CompileStep.
* removed unused field
* remove computeOutFileNames and inline the logic, making clear the
goal of avoiding state mutations after the build step is created.
These functions are problematic in light of dependencies because they
run and install, respectively, for the *owner* package rather than for
the *user* package. By removing these functions, the build script is
forced to provide the *Build object to associate the new step with,
making everything less surprising.
Unfortunately, this is a widely breaking change.
see #15079
* use the same hash function as the rest of the steps
* fix race condition due to a macOS oddity.
* fix race condition due to file truncation (rename into place instead)
* integrate with marking Step.result_cached. check if the file already
exists with fs.access before doing anything else.
* use a directory so that the file basename can be "options.zig"
instead of a hash digest.
* better error reporting in case of file system failures.
This test has a few problems:
* I don't want to vendor third party projects into the main compiler
repository such as kuba-zip just for test cases. If we want to test
third party projects, that should be a separate repository dedicated
to that purpose.
* Ideally tests would be isolated to test a particular thing, rather
than have a lot of unrelated logic that is not what is primarily
being tested.
* Ideally tests will not be named after GitHub issues, but named after
the thing that is being tested. And not testing for the absence of a
bug, but for the existence of correct behavior.
Aside from these issues, it's also failing in the LLVM 16 branch:
```
kuba-zip/zip.c:276:16: error: call to undeclared function 'fileno'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
kuba-zip/zip.c:277:14: error: call to undeclared function 'ftruncate'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
kuba-zip/zip.c:364:11: error: call to undeclared function 'symlink'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
```
These are not interesting failures related to the thing actually being
tested; this is busywork related to the fact that we vendor third party
code. So, that is why I chose to delete this test case instead of repair
it.
In master branch this test tests native Windows. In this branch, I
accidentally made aarch64-windows test x86_64-windows which caused some
subtle behavior that we aren't ready to add test coverage for yet.
This was from master branch commit
c93e0d8618. Since standalone test are
completely reworked, I had to resolve the merge conflict later, in this
commit.
std.Build.addTest creates a CompileStep as before, however, this kind of
step no longer actually runs the unit tests. Instead it only compiles
it, and one must additionally create a RunStep from the CompileStep in
order to actually run the tests.
RunStep gains integration with the default test runner, which now
supports the standard --listen=- argument in order to communicate over
stdin and stdout. It also reports test statistics; how many passed,
failed, and leaked, as well as directly associating the relevant stderr
with the particular test name that failed.
This separation of CompileStep and RunStep means that
`CompileStep.Kind.test_exe` is no longer needed, and therefore has been
removed in this commit.
* build runner: show unit test statistics in build summary
* added Step.writeManifest since many steps want to treat it as a
warning and emit the same message if it fails.
* RunStep: fixed error message that prints the failed command printing
the original argv and not the adjusted argv in case an interpreter
was used.
* RunStep: fixed not passing the command line arguments to the
interpreter.
* move src/Server.zig to std.zig.Server so that the default test runner
can use it.
* the simpler test runner function which is used by work-in-progress
backends now no longer prints to stderr, which is necessary in order
for the build runner to not print the stderr as a warning message.
* There was an edge case where the arena could be destroyed twice on
error: once from the arena itself and once from the decl destruction.
* The type of the created decl was incorrect (it should have been the
pointer child type), but it's not required anyway, so it's now just
initialized to anyopaque (which more accurately reflects what's
actually at that memory, since e.g. [*]T may correspond to nothing).
* A runtime bitcast of the pointer was performed, meaning @extern didn't
work at comptime. This is unnecessary: the decl_ref can just be
initialized with the correct pointer type.
And make it not do any installation, only objcopying. We already have
install steps for doing installation.
This commit also makes ObjCopyStep properly integrate with caching.
Fixes#13970.
This fix makes test runners resolve package paths relative to the
directory the test runner is in. This means it is not possible to import
a file from outside the file tree root at the directory containing the
test runner.
New API introduced: std.Build.addModule
This function exposes a zig module with the given name, which can be
used by packages that depend on this one via std.Build.Dependency.module.
std.Build.Pkg and related functionality is deleted. Every use case has a
straightforward upgrade path using the new Module struct.
std.Build.OptionsStep.getPackage is replaced by
std.Build.OptionsStep.createModule.
std.Build.CompileStep.addPackagePath is replaced by
std.Build.CompileStep.addAnonymousModule.
This partially addresses #14307 by renaming some of the instances of
"package" to "module".
Closes#14278
Fixes a regression caused by https://github.com/ziglang/zig/pull/13983
From the added comment:
We still search the path if the cwd is absolute because of the
"cwd set in ChildProcess is in effect when choosing the executable path
to match posix semantics" behavior--we don't want to skip searching
the PATH just because we were trying to set the cwd of the child process.