Merge remote-tracking branch 'origin' into libc-wasi-test

This commit is contained in:
Takeshi Yoneda 2021-08-09 14:39:26 +09:00
commit 97560cd915
437 changed files with 10206 additions and 65011 deletions

View File

@ -61,6 +61,7 @@ pub fn build(b: *Builder) !void {
const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false;
const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false;
const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);
const enable_macos_sdk = b.option(bool, "enable-macos-sdk", "Run tests requiring presence of macOS SDK and frameworks") orelse false;
const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h");
if (!skip_install_lib_files) {
@ -186,7 +187,7 @@ pub fn build(b: *Builder) !void {
},
2 => {
// Untagged development build (e.g. 0.8.0-684-gbbe2cca1a).
var it = mem.split(git_describe, "-");
var it = mem.split(u8, git_describe, "-");
const tagged_ancestor = it.next() orelse unreachable;
const commit_height = it.next() orelse unreachable;
const commit_id = it.next() orelse unreachable;
@ -340,7 +341,7 @@ pub fn build(b: *Builder) !void {
));
toolchain_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
toolchain_step.dependOn(tests.addStandaloneTests(b, test_filter, modes, skip_non_native, target));
toolchain_step.dependOn(tests.addStandaloneTests(b, test_filter, modes, skip_non_native, enable_macos_sdk, target));
toolchain_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));
toolchain_step.dependOn(tests.addCliTests(b, test_filter, modes));
toolchain_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
@ -478,7 +479,7 @@ fn addCxxKnownPath(
ctx.cxx_compiler,
b.fmt("-print-file-name={s}", .{objname}),
});
const path_unpadded = mem.tokenize(path_padded, "\r\n").next().?;
const path_unpadded = mem.tokenize(u8, path_padded, "\r\n").next().?;
if (mem.eql(u8, path_unpadded, objname)) {
if (errtxt) |msg| {
warn("{s}", .{msg});
@ -501,7 +502,7 @@ fn addCxxKnownPath(
}
fn addCMakeLibraryList(exe: *std.build.LibExeObjStep, list: []const u8) void {
var it = mem.tokenize(list, ";");
var it = mem.tokenize(u8, list, ";");
while (it.next()) |lib| {
if (mem.startsWith(u8, lib, "-l")) {
exe.linkSystemLibrary(lib["-l".len..]);
@ -595,11 +596,11 @@ fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeCon
},
};
var lines_it = mem.tokenize(config_h_text, "\r\n");
var lines_it = mem.tokenize(u8, config_h_text, "\r\n");
while (lines_it.next()) |line| {
inline for (mappings) |mapping| {
if (mem.startsWith(u8, line, mapping.prefix)) {
var it = mem.split(line, "\"");
var it = mem.split(u8, line, "\"");
_ = it.next().?; // skip the stuff before the quote
const quoted = it.next().?; // the stuff inside the quote
@field(ctx, mapping.field) = toNativePathSep(b, quoted);

View File

@ -69,9 +69,11 @@ release/bin/zig fmt --check ..
cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig"
make $JOBS install
for step in test-toolchain test-std docs; do
release/bin/zig build $step -Denable-qemu -Denable-wasmtime
done
release/bin/zig test ../test/behavior.zig -fno-stage1 -fLLVM -I ../test
release/bin/zig build test-toolchain -Denable-qemu -Denable-wasmtime
release/bin/zig build test-std -Denable-qemu -Denable-wasmtime
release/bin/zig build docs -Denable-qemu -Denable-wasmtime
# Look for HTML errors.
tidy -qe ../zig-cache/langref.html

View File

@ -54,9 +54,12 @@ make $JOBS install
cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig"
make $JOBS install
for step in test-toolchain test-std docs; do
release/bin/zig build $step
done
# TODO figure out why this causes a segmentation fault
# release/bin/zig test ../test/behavior.zig -fno-stage1 -fLLVM -I ../test
release/bin/zig build test-toolchain -Denable-macos-sdk
release/bin/zig build test-std
release/bin/zig build docs
if [ "${BUILD_REASON}" != "PullRequest" ]; then
mv ../LICENSE release/

View File

@ -26,6 +26,10 @@ cd %ZIGBUILDDIR%
cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b
msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b
REM Sadly, stage2 is omitted from this build to save memory on the CI server. Once self-hosted is
REM built with itself and does not gobble as much memory, we can enable these tests.
REM "%ZIGINSTALLDIR%\bin\zig.exe" test "..\test\behavior.zig" -fno-stage1 -fLLVM -I "..\test" || exit /b
"%ZIGINSTALLDIR%\bin\zig.exe" build test-toolchain -Dskip-non-native -Dskip-stage2-tests || exit /b
"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b
"%ZIGINSTALLDIR%\bin\zig.exe" build docs || exit /b

View File

@ -11,6 +11,11 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
mv dist/bin/zig.exe dist/
rmdir dist/bin
# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
mv dist/lib/zig dist/lib2
rmdir dist/lib
mv dist/lib2 dist/lib
VERSION=$(dist/zig.exe version)
DIRNAME="zig-windows-x86_64-$VERSION"
TARBALL="$DIRNAME.zip"

View File

@ -38,6 +38,11 @@ cmake .. \
-GNinja
samu install
# TODO ld.lld: error: undefined symbol: main
# >>> referenced by crt1_c.c:75 (/usr/src/lib/csu/amd64/crt1_c.c:75)
# >>> /usr/lib/crt1.o:(_start)
#release/bin/zig test ../test/behavior.zig -fno-stage1 -fLLVM -I ../test
# Here we skip some tests to save time.
release/bin/zig build test -Dskip-compile-errors -Dskip-non-native

View File

@ -51,6 +51,11 @@ samu install
unset CC
unset CXX
# TODO ld.lld: error: undefined symbol: main
#>>> referenced by crt0-common.c
#>>> /usr/lib/crt0.o:(___start)
#release/bin/zig test ../test/behavior.zig -fno-stage1 -fLLVM -I ../test
# Here we skip some tests to save time.
release/bin/zig build test -Dskip-compile-errors -Dskip-non-native

View File

@ -2846,7 +2846,7 @@ test "pointer to non-bit-aligned field" {
Zig should correctly understand the alignment of fields. However there is
<a href="https://github.com/ziglang/zig/issues/1994">a bug</a>:
</p>
{#code_begin|test_err#}
{#code_begin|test_err|expected type '*u32', found '*align(1) u32'#}
const S = packed struct {
a: u32,
b: u32,
@ -2855,6 +2855,7 @@ test "overaligned pointer to packed struct" {
var foo: S align(4) = undefined;
const ptr: *align(4) S = &foo;
const ptr_to_b: *u32 = &ptr.b;
_ = ptr_to_b;
}
{#code_end#}
<p>When this bug is fixed, the above test in the documentation will unexpectedly pass, which will
@ -3422,10 +3423,11 @@ test "call foo" {
<p>
Blocks are used to limit the scope of variable declarations:
</p>
{#code_begin|test_err|unused local variable#}
{#code_begin|test_err|use of undeclared identifier 'x'#}
test "access variable after block scope" {
{
var x: i32 = 1;
_ = x;
}
x += 1;
}
@ -7125,6 +7127,7 @@ fn func(y: *i32) void {
an integer or an enum.
</p>
{#header_close#}
{#header_open|@bitCast#}
<pre>{#syntax#}@bitCast(comptime DestType: type, value: anytype) DestType{#endsyntax#}</pre>
<p>
@ -7164,8 +7167,8 @@ fn func(y: *i32) void {
{#header_open|@boolToInt#}
<pre>{#syntax#}@boolToInt(value: bool) u1{#endsyntax#}</pre>
<p>
Converts {#syntax#}true{#endsyntax#} to {#syntax#}u1(1){#endsyntax#} and {#syntax#}false{#endsyntax#} to
{#syntax#}u1(0){#endsyntax#}.
Converts {#syntax#}true{#endsyntax#} to {#syntax#}@as(u1, 1){#endsyntax#} and {#syntax#}false{#endsyntax#} to
{#syntax#}@as(u1, 0){#endsyntax#}.
</p>
<p>
If the value is known at compile-time, the return type is {#syntax#}comptime_int{#endsyntax#}
@ -7987,6 +7990,17 @@ test "@hasDecl" {
</p>
{#header_close#}
{#header_open|@maximum#}
<pre>{#syntax#}@maximum(a: T, b: T) T{#endsyntax#}</pre>
<p>
Returns the maximum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise.
</p>
<p>
NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned.
</p>
{#see_also|@minimum|SIMD|Vectors#}
{#header_close#}
{#header_open|@memcpy#}
<pre>{#syntax#}@memcpy(noalias dest: [*]u8, noalias source: [*]const u8, byte_count: usize){#endsyntax#}</pre>
<p>
@ -8024,6 +8038,17 @@ mem.copy(u8, dest[0..byte_count], source[0..byte_count]);{#endsyntax#}</pre>
mem.set(u8, dest, c);{#endsyntax#}</pre>
{#header_close#}
{#header_open|@minimum#}
<pre>{#syntax#}@minimum(a: T, b: T) T{#endsyntax#}</pre>
<p>
Returns the minimum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise.
</p>
<p>
NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned.
</p>
{#see_also|@maximum|SIMD|Vectors#}
{#header_close#}
{#header_open|@wasmMemorySize#}
<pre>{#syntax#}@wasmMemorySize(index: u32) u32{#endsyntax#}</pre>
<p>
@ -8177,6 +8202,15 @@ test "@wasmMemoryGrow" {
a calling function, the returned address will apply to the calling function.
</p>
{#header_close#}
{#header_open|@select#}
<pre>{#syntax#}@select(comptime T: type, pred: std.meta.Vector(len, bool), a: std.meta.Vector(len, T), b: std.meta.Vector(len, T)) std.meta.Vector(len, T){#endsyntax#}</pre>
<p>
Selects values element-wise from {#syntax#}a{#endsyntax#} or {#syntax#}b{#endsyntax#} based on {#syntax#}pred{#endsyntax#}. If {#syntax#}pred[i]{#endsyntax#} is {#syntax#}true{#endsyntax#}, the corresponding element in the result will be {#syntax#}a[i]{#endsyntax#} and otherwise {#syntax#}b[i]{#endsyntax#}.
</p>
{#see_also|SIMD|Vectors#}
{#header_close#}
{#header_open|@setAlignStack#}
<pre>{#syntax#}@setAlignStack(comptime alignment: u29){#endsyntax#}</pre>
<p>

Some files were not shown because too many files have changed in this diff Show More