-
Notifications
You must be signed in to change notification settings - Fork 1
z: integrate GCC compile-only torture tests into test command #53
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # DejaGnu board file for Nanvix targets (i686-nanvix, x86_64-nanvix). | ||
| # | ||
| # This board enables running GCC's testsuite against the Nanvix cross-compiler. | ||
| # - Compile-only tests work without a simulator. | ||
| # - Execution tests use nanvixd.elf via the nanvix-sim-run wrapper script. | ||
| # | ||
| # Usage: | ||
| # make check-gcc RUNTESTFLAGS="--target_board=nanvix-sim" | ||
| # | ||
| # Environment variables: | ||
| # NANVIX_INSTALL_DIR - Path to the Nanvix toolchain install directory | ||
| # (default: /opt/nanvix) | ||
|
|
||
| load_generic_config "sim" | ||
| load_base_board_description "basic-sim" | ||
|
|
||
| process_multilib_options "" | ||
|
|
||
| # Compiler is found automatically when testing GCC in-tree. | ||
| set_board_info compiler "[find_gcc]" | ||
|
|
||
| # Resolve install directory from environment or use default. | ||
| if {[info exists ::env(NANVIX_INSTALL_DIR)]} { | ||
| set nanvix_install $::env(NANVIX_INSTALL_DIR) | ||
| } else { | ||
| set nanvix_install "/opt/nanvix" | ||
| } | ||
|
|
||
| # Use newlib include/link flags from the build tree if available. | ||
| set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]" | ||
|
|
||
| # Link flags for execution tests. Compile-only tests (dg-do compile) never link, | ||
| # so these only apply to dg-do run/link tests. | ||
| # Note: This board is configured for a single target at a time (i686-nanvix OR | ||
| # x86_64-nanvix). The toolchain is built per-target, so the sysroot artifacts in | ||
| # ${nanvix_install}/lib/ match the configured target. Multilib is disabled | ||
| # (--disable-multilib in the GCC configure step). | ||
| set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags] -T ${nanvix_install}/lib/user.ld -Wl,--start-group ${nanvix_install}/lib/libposix.a -lc -Wl,--end-group" | ||
|
|
||
| # Simulator configuration: use the nanvix-sim-run wrapper. | ||
| # The wrapper script must be on PATH or specified as an absolute path. | ||
| if {[info exists ::env(NANVIX_SIM_RUN)]} { | ||
| set_board_info sim $::env(NANVIX_SIM_RUN) | ||
| } else { | ||
| set_board_info sim "${nanvix_install}/libexec/nanvixd/nanvix-sim-run" | ||
| } | ||
|
|
||
| # Time limit for program execution (seconds). | ||
| set_board_info sim_time_limit 60 | ||
|
|
||
| # Target capabilities and limitations. | ||
| set_board_info is_simulator 1 | ||
| set_board_info slow_simulator 1 | ||
| # No command-line argument support. | ||
| set_board_info noargs 1 | ||
| # No signal support. | ||
| set_board_info gcc,nosignals 1 | ||
| set_board_info gcc,signal_suppress 1 | ||
| # No file I/O support beyond stdout. | ||
| set_board_info gcc,no_abs 1 | ||
| # Compilation timeout (seconds). | ||
| set_board_info gcc,timeout 300 | ||
| # The simulator does not return exit status via the process exit code; | ||
| # DejaGnu must link a status wrapper that prints exit status to stdout. | ||
| set_board_info needs_status_wrapper 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/bin/bash | ||
| # | ||
| # nanvix-sim-run — DejaGnu simulator wrapper for Nanvix. | ||
| # | ||
| # This script adapts nanvixd.elf to the interface DejaGnu expects: | ||
| # nanvix-sim-run <binary> | ||
| # | ||
| # It runs the given ELF binary on nanvixd and passes through stdout/stderr. | ||
| # Exit code: 0 if nanvixd ran the program successfully, non-zero otherwise. | ||
| # | ||
| # Environment variables: | ||
| # NANVIX_INSTALL_DIR - Path to the Nanvix toolchain install (default: /opt/nanvix) | ||
| # NANVIX_SIM_TIMEOUT - Timeout in seconds (default: 30) | ||
| # NANVIX_SIM_LOG_DIR - Directory for nanvixd diagnostic logs (default: /tmp) | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| NANVIX_INSTALL_DIR="${NANVIX_INSTALL_DIR:-/opt/nanvix}" | ||
| NANVIX_SIM_TIMEOUT="${NANVIX_SIM_TIMEOUT:-30}" | ||
| NANVIX_SIM_LOG_DIR="${NANVIX_SIM_LOG_DIR:-/tmp}" | ||
|
|
||
| nanvixd="${NANVIX_INSTALL_DIR}/libexec/nanvixd/nanvixd.elf" | ||
| bin_dir="${NANVIX_INSTALL_DIR}/libexec/nanvixd" | ||
|
|
||
| if [[ $# -lt 1 ]]; then | ||
| echo "Usage: nanvix-sim-run <binary>" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| binary="$1" | ||
| shift | ||
|
|
||
| if [[ ! -f "${binary}" ]]; then | ||
| echo "ERROR: Binary not found: ${binary}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ! -x "${nanvixd}" ]]; then | ||
| echo "ERROR: nanvixd.elf not found at '${nanvixd}'." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! command -v timeout >/dev/null 2>&1; then | ||
| echo "ERROR: 'timeout' utility not available." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Log nanvixd diagnostics to a separate file rather than discarding them; | ||
| # the test program's stderr is passed through so DejaGnu can inspect it. | ||
| nanvixd_log="${NANVIX_SIM_LOG_DIR}/nanvix-sim-run.$$.log" | ||
|
|
||
| # Run the binary on nanvixd with a kill signal fallback. | ||
| # Use --foreground so nanvixd receives signals properly in a pipeline. | ||
| timeout --foreground -k 5 "${NANVIX_SIM_TIMEOUT}" \ | ||
| "${nanvixd}" \ | ||
| -bin-dir "${bin_dir}" \ | ||
| -console-file /dev/stdout \ | ||
| -- "${binary}" </dev/null 2>"${nanvixd_log}" | ||
| rc=$? | ||
|
|
||
| if [[ $rc -eq 124 ]]; then | ||
| echo "NANVIX-SIM-TIMEOUT: Program exceeded ${NANVIX_SIM_TIMEOUT}s time limit." >&2 | ||
| fi | ||
|
|
||
| exit $rc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # DejaGnu site configuration for Nanvix GCC testing. | ||
| # | ||
| # This file is sourced by DejaGnu via the DEJAGNU environment variable. | ||
| # It sets up the board search path so that the nanvix-sim board file is found. | ||
| # | ||
| # Usage: | ||
| # export DEJAGNU=/path/to/this/site.exp | ||
| # make check-gcc RUNTESTFLAGS="--target_board=nanvix-sim compile.exp" | ||
|
|
||
| # Add the Nanvix board directory to the search path. | ||
| lappend boards_dir "@NANVIX_BOARDS_DIR@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.