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

Make generated test failures more useful #1498

Closed
wants to merge 1 commit into from

Commits on Aug 12, 2023

  1. Make generated test failures more useful

    Currently, when a `sys` compilation fails, the only context given is the
    command used to compile the code.
    
    This is less than helpful. This PR adds all the compilation commands'
    output to the error message.
    
    It also prints the message. `unwrap` doesn't format properly error
    messages, so we use `println!` as well. This results in the output being
    duplicated.
    
    I consider the duplicate output to be acceptable, it's already far
    better than the current output, the fact that code is generated makes
    testing and developing a lot harder and we shouldn't let perfect be
    enemy of the better.
    
    Here is a sample of the difference this commit makes:
    
    BEFORE
    
    ```
    thread 'cross_validate_layout_with_c' panicked at 'called `Result::unwrap()` on an `Err` value: "compilation command \"cc\" \"-Wno-deprecated-declarations\" \"-std=c11\" \"-D__USE_MINGW_ANSI_STDIO\" \"-I/usr/include/wpe-webkit-1.1\" \"-I/usr/include/glib-2.0\" \"-I/usr/lib/glib-2.0/include\" \"-I/usr/include/sysprof-4\" \"-I/usr/include/libsoup-3.0\" \"-I/usr/include/libmount\" \"-I/usr/include/blkid\" \"-pthread\" \"-I/usr/include/wpe-1.0\" \"-DWPE_ENABLE_XKB=1\" \"tests/layout.c\" \"-o\" \"/tmp/abiXdITDL/layout\" failed, exit status: 1"
    ```
    
    AFTER
    
    ```
    compilation command "cc" "-Wno-deprecated-declarations" "-std=c11" "-D__USE_MINGW_ANSI_STDIO" "-I/usr/include/wpe-webkit-1.1" "-I/usr/include/glib-2.0" "-I/usr/lib/glib-2.0/include" "-I/usr/include/sysprof-4" "-I/usr/include/libsoup-3.0" "-I/usr/include/libmount" "-I/usr/include/blkid" "-pthread" "-I/usr/include/wpe-1.0" "-DWPE_ENABLE_XKB=1" "tests/layout.c" "-o" "/tmp/abiXdITDL/layout" failed, exit status: 1
    stdout:
    stderr: In file included from tests/layout.c:7:
    tests/manual.h:3:10: fatal error: cog/cog.h: No such file or directory
        3 | #include <cog/cog.h>
          |          ^~~~~~~~~~~
    compilation terminated.
    
    thread 'cross_validate_layout_with_c' panicked at 'called `Result::unwrap()` on an `Err` value: "compilation command \"cc\" \"-Wno-deprecated-declarations\" \"-std=c11\" \"-D__USE_MINGW_ANSI_STDIO\" \"-I/usr/include/wpe-webkit-1.1\" \"-I/usr/include/glib-2.0\" \"-I/usr/lib/glib-2.0/include\" \"-I/usr/include/sysprof-4\" \"-I/usr/include/libsoup-3.0\" \"-I/usr/include/libmount\" \"-I/usr/include/blkid\" \"-pthread\" \"-I/usr/include/wpe-1.0\" \"-DWPE_ENABLE_XKB=1\" \"tests/layout.c\" \"-o\" \"/tmp/abiXdITDL/layout\" failed, exit status: 1\nstdout: \nstderr: In file included from tests/layout.c:7:\ntests/manual.h:3:10: fatal error: cog/cog.h: No such file or directory\n    3 | #include <cog/cog.h>\n      |          ^~~~~~~~~~~\ncompilation terminated.\n"', tests/abi.rs:198:31
    ```
    nicopap committed Aug 12, 2023
    Configuration menu
    Copy the full SHA
    256f6cf View commit details
    Browse the repository at this point in the history