Commit Graph

250 Commits

Author SHA1 Message Date
Andrew Kelley 05ae86bc6b fix compilation errors from rebase conflicts 2026-04-19 10:56:47 -07:00
Andrew Kelley 0bca61e6bf configurer: back out the string interning from prev commit
partial revert of 2d3fbb687fba1ed52b42998ac4dcbf2a042644ea - see its
commit message for reasoning
2026-04-19 10:56:47 -07:00
Andrew Kelley 11c770c570 configurer: make string duplication also intern
I had this idea to make b.dupe() also intern the strings since they will
be ultimately serialized to Configuration. Unfortunately the idea does
not work, because although a process-lived arena is used for the
string_bytes ArrayList of the Configuration.Wip, when the ArrayList is
resized, Allocator.free() memsets the freed memory to undefined, even
though it still technically lives due to being in a process-scoped
arena. So this commit will need to be partially reverted. However, I
kept it for posterity, and there are some more changes which I will now
note below.

- dupePaths: don't rewrite backslashes to forward slashes. backslashes
  are valid in filenames on non-windows systems.
- always compile configurer in single-threaded mode
- use arena allocator for everything, no gpa for anything
- construct the Configuration.Wip instance earlier, so some stuff can be
  prepopulated as desired.
- don't forget to flush
2026-04-19 10:56:47 -07:00
Andrew Kelley 8c380915db std: rename zig.Configuration to Build.Configuration 2026-04-19 10:56:47 -07:00
Andrew Kelley e5c7c510ae build system: implement LazyPath
Number of generated files is recorded in serialized Configuration. Maker
preallocates array of generated files so that loads and stores can be
synchronization-free (protected by the dependency tree ordering).

More progress on Compile Step Zig CLI lowering.
2026-04-19 10:56:47 -07:00
Andrew Kelley a349922261 Maker.Step.Compile: progress towards lowering zig args 2026-04-19 10:56:46 -07:00
Andrew Kelley 82e3f0d619 massage Step code into compiling 2026-04-19 10:56:46 -07:00
Andrew Kelley 21d76c5bb5 make runner: prepare steps for execution 2026-04-19 10:56:46 -07:00
Andrew Kelley e88fdc72ee make runner gets compiled and run
and --print-configuration prints some deserialized stuff
2026-04-19 10:56:46 -07:00
Andrew Kelley c3168cf25a configure runner: implement serialization of InstallArtifact 2026-04-19 10:56:46 -07:00
Andrew Kelley af30dbf9af zig build: configure runner basics implemented 2026-04-19 10:56:46 -07:00
Andrew Kelley 67a5b6e5e8 delete @cImport from the language
closes #20630
2026-04-15 17:43:53 -07:00
Alex Rønne Petersen d6f43caadf Merge pull request 'audit: handle process.Child.Term exhaustively and give useful exit information on process exit' (#31018) from murtaza/zig:child.term-audit into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31018
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-04-11 00:59:11 +02:00
Andrew Kelley c3a862522b std: remove managed array hash map variants
And deprecate all the API names except for:
* `std.array_hash_map.Auto`
* `std.array_hash_map.String`
* `std.array_hash_map.Custom`
2026-04-10 17:39:45 +02:00
murtaza 4a1383d987 process.Child: use std.posix.SIG instead of u32 for Child.Term stopped field 2026-04-07 10:27:21 +02:00
Kendall Condon d8ba173e5e multiprocess fuzzing
- New Features

-- Multiprocess Fuzzing

The fuzzer now is able to utilize multiple cores. This is controllable
with the `-j` build option. Limited fuzzing still uses one core.

-- Fuzzing Infinite Mode

When provided multiple tests, the fuzzer now switches between them and
prioritizes the most effective and interesting ones. Over time already
explored tests will become barely run compared to tests yielding new
inputs.

-- Crash Dumps

Crashing inputs are now saved to a file indicated by the crash message.
It is recommended to use these files to reproduce the crash using
`std.testing.FuzzInputOptions.corpus` and @embedFile.

- Design

Each fuzzing process is assigned an instance id which has the following
uses:
* In conjunction with the pc hash and running test index, they uniquely
  identify input files in the case of a crash.
* It is combined with the test seed for a unique rng seed.
* Instance 0 is solely responsible for syncing the filesystem corpus.

When new inputs are found, they are sent to the build server. It then
distributes the new input to the other instances. Each instance has a
concurrent poller managed by the test runner which sends received
inputs to libfuzzer. (note that this is affected by #31718 and so can
(rarely) deadlock)

For fuzzing infinite mode, the test runner now receives a list of tests
from the build server. The fuzzer runs tests in batches of one second,
approximated in cycles by the previous batch's run speed. Tests finding
new inputs or with few runs are given a higher run chance. The baseline
run chance is based off the recency of the last find and the number of
pcs the test has hit.
2026-04-03 12:27:34 +02:00
Kendall Condon e40557b1f7 allow specifying mode in --debug-rt
The motivation is that libfuzzer is slow in Debug mode and bugs usually
manifest late into fuzzing, which makes testing it in ReleaseSafe
useful.
2026-02-13 17:58:09 -05:00
antme0 fb18f2096a Allow build.zig scripts to define module definition files (.def) when building win32 dlls. 2026-02-09 07:58:13 +01:00
Ryan Liptak 05346e123b Add process.Child.Cwd, use it for cwd and remove cwd_dir field
The user must now explicitly choose between inheriting the current CWD, passing a path for the CWD, or passing a Dir for the CWD.
2026-02-02 01:41:35 -08:00
Andrew Kelley b4dbe483a7 std.Build: adjust temp files API
Remove the RemoveDir step with no replacement. This step had no valid
purpose. Mutating source files? That should be done with
UpdateSourceFiles step. Deleting temporary directories? That required
creating the tmp directories in the configure phase which is broken.
Deleting cached artifacts? That's going to cause problems.

Similarly, remove the `Build.makeTempPath` function. This was used to
create a temporary path in the configure place which, again, is the
wrong place to do it.

Instead, the WriteFile step has been updated with more functionality:

tmp mode: In this mode, the directory will be placed inside "tmp" rather
than "o", and caching will be skipped. During the `make` phase, the step
will always do all the file system operations, and on successful build
completion, the dir will be deleted along with all other tmp
directories. The directory is therefore eligible to be used for
mutations by other steps. `Build.addTempFiles` is introduced to
initialize a WriteFile step with this mode.

mutate mode: The operations will not be performed against a freshly
created directory, but instead act against a temporary directory.
`Build.addMutateFiles` is introduced to initialize a WriteFile step with
this mode.

`Build.tmpPath` is introduced, which is a shortcut for
`Build.addTempFiles` followed by `WriteFile.getDirectory`.

* give Cache a gpa rather than arena because that's what it asks for
2026-01-04 17:23:45 -08:00
Andrew Kelley 1070c2a71a rename env_map to environ_map
For naming consistency with `std.process.Environ.Map`.
2026-01-04 00:27:09 -08:00
Andrew Kelley 08447ca47e std.fs.path: make relative a pure function
Instead of querying the operating system for current working directory
and environment variables, this function now accepts those things as
inputs.
2026-01-04 00:27:08 -08:00
Andrew Kelley 9009ab2495 std.Io.Threaded: make environ init non-optional
and argv0 on systems that need it too.

fixes surprising behavior for applications that forget to initialize the
environment field.
2026-01-04 00:27:08 -08:00
Andrew Kelley 32af0f6154 std: move child process APIs to std.Io
this gets the build runner compiling again on linux

this work is incomplete; it only moves code around so that environment
variables can be wrangled properly. a future commit will need to audit
the cancelation and error handling of this moved logic.
2026-01-04 00:27:08 -08:00
Andrew Kelley d6a1e73142 std: start wrangling environment variables and process args
this commit is unfinished. It marks a spot where I wanted to start
moving child process stuff below the std.Io.VTable
2026-01-04 00:27:07 -08:00
hixuyuming 0c5f879b98 Fix: tryFindProgram fails when $PATH contains relative paths (#30619)
Fixes a issue in tryFindProgram where it would fail if the PATH environment variable contained relative paths, due to its incorrect assumption that the full_path argument is always absolute path.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30619
Co-authored-by: hixuyuming <hixuyuming@gmail.com>
Co-committed-by: hixuyuming <hixuyuming@gmail.com>
2026-01-02 02:51:16 +01:00
Andrew Kelley 70e19ea353 update more "realpath" callsites 2025-12-23 22:15:11 -08:00
Ryan Liptak 51a6f3a525 Update a few more callsites for std.Io changes 2025-12-23 22:15:11 -08:00
Andrew Kelley a8088306f6 std: rename other Dir "make" functions to "create" 2025-12-23 22:15:11 -08:00
Andrew Kelley 608145c2f0 fix more fallout from locking stderr 2025-12-23 22:15:10 -08:00
Andrew Kelley 1925e0319f update lockStderrWriter sites
use the application's Io implementation where possible. This correctly
makes writing to stderr cancelable, fallible, and participate in the
application's event loop. It also removes one more hard-coded
dependency on a secondary Io implementation.
2025-12-23 22:15:09 -08:00
Andrew Kelley e1cf753db7 std: update fchmodat tests 2025-12-23 22:15:09 -08:00
Andrew Kelley b042e93522 std: update tty config references in the build system 2025-12-23 22:15:09 -08:00
Andrew Kelley 4a53e5b0b4 fix a handful of compilation errors related to std.fs migration 2025-12-23 22:15:08 -08:00
Andrew Kelley 950d18ef69 update all access() to access(io) 2025-12-23 22:15:08 -08:00
Andrew Kelley 9ccd68de0b std: move abort and exit from posix into process
and delete the unit tests that called fork()

no forking allowed in the std lib, including unit tests, except to implement child process spawning.
2025-12-23 22:15:08 -08:00
Andrew Kelley 264d714321 update all openDir() sites to accept io instance 2025-12-23 22:15:08 -08:00
Andrew Kelley f53248a409 update all std.fs.cwd() to std.Io.Dir.cwd() 2025-12-23 22:15:08 -08:00
Andrew Kelley dd1d15b72a update all occurrences of std.fs.Dir to std.Io.Dir 2025-12-23 22:15:08 -08:00
Andrew Kelley 3204fb7569 update all occurrences of std.fs.File to std.Io.File 2025-12-23 22:15:07 -08:00
Andrew Kelley d1d2c37af2 std: all Dir functions moved to std.Io 2025-12-23 22:15:07 -08:00
Luna Schwalbe adc5a39de2 Change github links to codeberg 2025-12-05 14:12:39 +01:00
Ali Cheraghi dec1163fbb all: replace all @Type usages
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-11-22 22:42:38 +00:00
Matthew Lugg 74931fe25c std.debug.lockStderrWriter: also return ttyconf
`std.Io.tty.Config.detect` may be an expensive check (e.g. involving
syscalls), and doing it every time we need to print isn't really
necessary; under normal usage, we can compute the value once and cache
it for the whole program's execution. Since anyone outputting to stderr
may reasonably want this information (in fact they are very likely to),
it makes sense to cache it and return it from `lockStderrWriter`. Call
sites who do not need it will experience no significant overhead, and
can just ignore the TTY config with a `const w, _` destructure.
2025-10-30 09:31:28 +00:00
Andrew Kelley 47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Andrew Kelley 066864a0bf std.zig.system: upgrade to std.Io.Reader 2025-10-29 06:20:48 -07:00
mlugg d0b92a8022 std.Build: do not expect server protocol for tests using immature backends
For instance, when running a Zig test using the self-hosted aarch64
backend, this logic was previously expecting `std.zig.Server` to be
used, but the default test runner intentionally does not do this because
the backend is too immature to handle it. On 'master', this is causing
sporadic failures; on this branch, they became consistent failures.
2025-10-18 09:28:42 +01:00
mlugg a388a8e5a7 std.Build: separate errors from failed commands
Recording the command in a separate field will give the build runner
more freedom to choose how and when the command should be printed.
2025-10-18 09:28:42 +01:00
tehlordvortex 60a332406c std.Build: duplicate sub_path for LazyPath's dependency variant 2025-10-08 11:50:51 +01:00
mlugg c2ada49354 replace usages of old std.debug APIs
src/crash_handler.zig is still TODO though, i am planning bigger changes there
2025-09-30 13:44:51 +01:00