Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std lib tests failing on arm 32-bit #3289

Closed
andrewrk opened this issue Sep 22, 2019 · 4 comments · Fixed by #4102
Closed

std lib tests failing on arm 32-bit #3289

andrewrk opened this issue Sep 22, 2019 · 4 comments · Fixed by #4102
Labels
arch-arm 32-bit ARM bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

316/1221 fmt.parse_float.test "std-arm-linux-none-Debug-bare-multi fmt.parseFloat"...qemu: uncaught target signal 4 (Illegal instruction) - core dumped

Tests failed. Use the following command to reproduce the failure:
/home/andy/dev/zig/zig-cache/o/IeIFkTyM_4eX5VwOLuC_6kygDea91Ir46YZKjmfvWuSFFvebBdbDgTjao_Q1X2Hi/test
The following command exited with error code 255:
/home/andy/dev/zig/build/zig test /home/andy/dev/zig/std/std.zig --test-name-prefix std-arm-linux-none-Debug-bare-multi  --cache-dir /home/andy/dev/zig/zig-cache --name test -target armv8_5a-linux-none --test-cmd qemu-arm --test-cmd-bin --override-std-dir /home/andy/dev/zig/std 
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. arch-arm 32-bit ARM labels Sep 22, 2019
@andrewrk andrewrk added this to the 0.6.0 milestone Sep 22, 2019
@LemonBoy
Copy link
Contributor

Cannot reproduce locally, the std test suite completes successfully.

andrewrk added a commit that referenced this issue Sep 22, 2019
 * add zig build option `-Dskip-libc` to skip tests that build libc
   (e.g. if you don't want to wait for musl to build)
 * add `-Denable-wine` option which uses wine to run cross compiled
   windows tests on non-windows hosts
 * add `-Denable-qemu` option which uses qemu to run cross compiled
   foreign architecture tests
 * add `-Denable-foreign-glibc=path` option which combined with
   `-Denable-qemu` enables running cross compiled tests that link
   against glibc. See
   https://github.com/ziglang/zig/wiki/Updating-libc#glibc for how to
   produce this directory.
 * the test matrix is done manually. release test builds are only
   enabled by default for the native target. this should save us some CI
   time, while still providing decent coverage of release builds.
   - add test coverage for `x86_64-linux-musl -lc` (building musl libc)
   - add test coverage for `x86_64-linux-gnu -lc` (building glibc)
   - add test coverage for `aarch64v8_5a-linux-none`
   - add test coverage for `aarch64v8_5a-linux-musl -lc` (building musl libc)
   - add test coverage for `aarch64v8_5a-linux-gnu -lc` (building glibc)
   - add test coverage for `arm-linux-none`
   - test coverage for `arm-linux-musleabihf -lc` (building musl libc) is
     disabled due to #3286
   - test coverage for `arm-linux-gnueabihf -lc` (building glibc) is disabled
     due to #3287
   - test coverage for `x86_64-windows-gnu -lc` (building mingw-w64) is
     disabled due to #3285
 * enable qemu testing on the Linux CI job. There's not really a good
   reason to enable wine, since we have a Windows CI job as well.
 * remove the no longer needed `--build-file ../build.zig` from CI
   scripts
 * fix bug in glibc compilation where it wasn't properly reading the abi
   list txt files, resulting in "key not found" error.
 * std.build.Target gains:
   - isNetBSD
   - isLinux
   - osRequiresLibC
   - getArchPtrBitWidth
   - getExternalExecutor
 * zig build system gains support for enabling wine and enabling qemu.
   `artifact.enable_wine = true;`, `artifact.enable_qemu = true;`. This
   communicates that the system has these tools installed and the build
   system will use them to run tests.
 * zig build system gains support for overriding the dynamic linker of
   an executable artifact.
 * fix std.c.lseek prototype. makes behavior tests for
   arm-linux-musleabihf pass.
 * disable std lib tests that are failing on ARM. See #3288, #3289
 * provide `std.os.off_t`.
 * disable some of the compiler_rt symbols for arm 32 bit. Fixes
   compiler_rt tests for arm 32 bit
 * add __stack_chk_guard when linking against glibc. Fixes std lib tests
   for aarch64-linux-gnu
 * workaround for "unable to inline function" using `@inlineCall`. Fixes
   compiler_rt tests for arm 32 bit.
@andrewrk
Copy link
Member Author

Cannot reproduce locally, the std test suite completes successfully.

Just double checking, you removed the if here and tried it?

zig/std/fmt/parse_float.zig

Lines 385 to 388 in dc3c419

if (@import("builtin").arch == .arm) {
// TODO https://github.com/ziglang/zig/issues/3289
return error.SkipZigTest;
}

@andrewrk
Copy link
Member Author

Another issue, I suspect we have a problem with compiler-rt when hard-float enabled:

52/1227 fmt.test "std-arm-linux-musleabihf-Debug-c-multi filesize"...integer part of floating point value out of bounds
/home/andy/dev/zig/std/math/pow.zig:148:13: 0x4f5c47 in math.pow.pow (test)
    var i = @floatToInt(@IntType(true, T.bit_count), yi);
            ^
/home/andy/dev/zig/std/fmt.zig:820:55: 0x4e9053 in fmt.formatBytes (test)
    const new_value = lossyCast(f64, value) / math.pow(f64, lossyCast(f64, radix), lossyCast(f64, magnitude));
                                                      ^
/home/andy/dev/zig/std/fmt.zig:439:27: 0x2b5af3 in fmt.formatValue (test)
        return formatBytes(value, options, 1024, context, Errors, output);
                          ^
/home/andy/dev/zig/std/fmt.zig:295:31: 0x22f4a3 in fmt.formatType (test)
            return formatValue(value, fmt, options, context, Errors, output);
                              ^
/home/andy/dev/zig/std/fmt.zig:164:35: 0x22f3d7 in fmt.format (test)
                    try formatType(
                                  ^
/home/andy/dev/zig/std/fmt.zig:1065:15: 0x22f217 in fmt.bufPrint (test)
    try format(&context, error{BufferTooSmall}, bufPrintWrite, fmt, args);
              ^
/home/andy/dev/zig/std/fmt.zig:1468:32: 0x1b00ab in fmt.testFmt (test)
    const result = try bufPrint(buf[0..], template, args);
                               ^
/home/andy/dev/zig/std/fmt.zig:1236:16: 0xd4567 in fmt.test "std-arm-linux-musleabihf-Debug-c-multi filesize" (test)
    try testFmt("file size: 63MiB\n", "file size: {Bi}\n", usize(63 * 1024 * 1024));
               ^
/home/andy/dev/zig/std/special/test_runner.zig:13:25: 0x7b3f33 in std.special.main (test)
        if (test_fn.func()) |_| {
                        ^
/home/andy/dev/zig/std/special/start.zig:189:37: 0x7b3ceb in std.special.main (test)
            const result = root.main() catch |err| {

755/1227 math.pow.test "std-arm-linux-musleabihf-Debug-c-multimath.pow"...integer part of floating point value out of bounds
/home/andy/dev/zig/std/math/pow.zig:148:13: 0x5695eb in math.pow.pow (test)
    var i = @floatToInt(@IntType(true, T.bit_count), yi);
            ^
/home/andy/dev/zig/std/math/pow.zig:197:34: 0x16a44b in math.pow.test "std-arm-linux-musleabihf-Debug-c-multimath.pow" (test)
    expect(math.approxEq(f64, pow(f64, 0.8923, 3.3), 0.686572, epsilon));
                                 ^
/home/andy/dev/zig/std/special/test_runner.zig:13:25: 0x744fd3 in std.special.main (test)
        if (test_fn.func()) |_| {
                        ^
/home/andy/dev/zig/std/special/start.zig:189:37: 0x74455b in std.special.posixCallMainAndExit (test)
            const result = root.main() catch |err| {
                                    ^
/home/andy/dev/zig/std/special/start.zig:87:5: 0x74440b in std.special._start (test)
    @noInlineCall(posixCallMainAndExit);
    ^

I'm disabling a lot of the math tests for armv8-linux-musleabihf.

@SamTebbs33
Copy link
Contributor

The parseFloat failure is fixed and the math and filesize tests are still failing. Command used: zig test lib/std/std.zig -target armv8_5a-linux-musleabihf --test-cmd qemu-arm --test-cmd-bin --override-lib-dir lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm 32-bit ARM bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants