Skip to content

Commit

Permalink
Merge pull request #6948 from roc-lang/test-in-debug
Browse files Browse the repository at this point in the history
cargo test in debug mode
  • Loading branch information
Anton-4 authored Jul 31, 2024
2 parents d23426a + 1a8a739 commit 7992d99
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ jobs:
if: needs.check-changes.outputs.run_tests == 'full'
uses: ./.github/workflows/ubuntu_x86_64.yml

start-ubuntu-x86-64-tests-debug:
needs: check-changes
if: needs.check-changes.outputs.run_tests == 'full'
uses: ./.github/workflows/ubuntu_x86_64_debug.yml

start-windows-release-build-test:
needs: check-changes
if: needs.check-changes.outputs.run_tests == 'full'
Expand All @@ -128,6 +133,7 @@ jobs:
start-nix-macos-apple-silicon-tests,
start-macos-x86-64-tests,
start-ubuntu-x86-64-tests,
start-ubuntu-x86-64-tests-debug,
start-windows-release-build-test,
start-windows-tests,
start-roc-benchmarks
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/ubuntu_x86_64_debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
workflow_call:

name: cargo test debug

env:
RUST_BACKTRACE: 1

jobs:
cargo-test-debug:
name: cargo test debug
runs-on: [ubuntu-22.04]
timeout-minutes: 90
steps:
- uses: actions/checkout@v4

- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0

- run: zig version

- name: Install dependencies
run: |
sudo apt -y install build-essential libunwind-dev pkg-config zlib1g-dev valgrind
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16
sudo rm /usr/bin/clang
sudo ln -s /usr/bin/clang-16 /usr/bin/clang
sudo ln -s /usr/bin/lld-16 /usr/bin/ld.lld
sudo apt -y install libpolly-16-dev
# for skipped tests; see #6946, #6947
- name: cargo test without --release
env:
RUSTFLAGS: -C link-arg=-fuse-ld=lld
run: cargo test -- --skip tests/exhaustive/match_on_result_with_uninhabited_error_destructuring_in_lambda_syntax.txt --skip tests::identity_lambda --skip tests::issue_2300 --skip tests::issue_2582_specialize_result_value --skip tests::sum_lambda
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/cli_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ roc_command_utils = { path = "../utils/command" }

bumpalo.workspace = true
criterion.workspace = true
regex.workspace = true
serde-xml-rs.workspace = true
serde.workspace = true
tempfile.workspace = true
Expand Down
23 changes: 14 additions & 9 deletions crates/cli_utils/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extern crate roc_load;
extern crate roc_module;
extern crate tempfile;

use regex::Regex;
use roc_command_utils::{cargo, pretty_command_string, root_dir};
use serde::Deserialize;
use serde_xml_rs::from_str;
Expand Down Expand Up @@ -49,19 +50,23 @@ where
}

pub fn has_error(stderr: &str) -> bool {
let stderr_stripped = stderr
.replacen("🔨 Rebuilding platform...\n", "", 1)
// for some reason, llvm prints out this warning when targeting windows
.replacen(
"warning: ignoring debug info with an invalid version (0) in app\r\n",
"",
1,
);
let stderr_stripped = {
let regx = Regex::new(r"\[.*? / .*?\]").unwrap(); // e.g. [20.7 / 20.7 MB] when downloading platform
regx.replace_all(stderr, "")
}
.replace('\u{1b}', "") // also shown when downloading platform
.replacen("🔨 Rebuilding platform...\n", "", 1)
// for some reason, llvm prints out this warning when targeting windows
.replacen(
"warning: ignoring debug info with an invalid version (0) in app\r\n",
"",
1,
);

let is_reporting_runtime =
stderr_stripped.starts_with("runtime: ") && stderr_stripped.ends_with("ms\n");

let is_clean = stderr_stripped.is_empty() ||
let is_clean = stderr_stripped.trim().is_empty() ||
is_reporting_runtime ||
// macOS ld reports this warning, but if we remove -undefined dynamic_lookup,
// linking stops working properly.
Expand Down

0 comments on commit 7992d99

Please sign in to comment.