Skip to content

Commit 9cfc7d3

Browse files
committed
Modifies CI to pass profile to test tool
1 parent 3ef10b0 commit 9cfc7d3

File tree

9 files changed

+62
-31
lines changed

9 files changed

+62
-31
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ jobs:
220220
if: matrix.build_std != ''
221221
222222
# Configure some env vars based on matrix configuration
223-
- run: echo "PROFILE=--profile=${{matrix.profile}}" >> $GITHUB_ENV
223+
- run: echo "PROFILE=${{matrix.profile}}" >> $GITHUB_ENV
224224
shell: bash
225225
- run: echo "NORUN=1" >> $GITHUB_ENV
226226
shell: bash
@@ -280,7 +280,7 @@ jobs:
280280
if: ${{ matrix.build_std }}
281281
282282
# Configure some env vars based on matrix configuration
283-
- run: echo "PROFILE=--profile=${{ matrix.profile }}" >> $GITHUB_ENV
283+
- run: echo "PROFILE=${{ matrix.profile }}" >> $GITHUB_ENV
284284
- run: ./ci/intrinsic-test-docker.sh ${{ matrix.target }}
285285
if: ${{ !startsWith(matrix.target, 'thumb') }}
286286
env:

ci/intrinsic-test-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ run() {
3030
--env CARGO_HOME=/cargo \
3131
--env CARGO_TARGET_DIR=/checkout/target \
3232
--env TARGET="${1}" \
33+
--env PROFILE \
3334
--env "${HOST_LINKER}"="cc" \
3435
--env STDARCH_DISABLE_ASSERT_INSTR \
3536
--env NOSTD \

ci/intrinsic-test.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -ex
66

77
export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
88
export HOST_RUSTFLAGS="${RUSTFLAGS}"
9-
export PROFILE="${PROFILE:="--profile=release"}"
9+
export PROFILE="${PROFILE:="release"}"
1010

1111
case ${TARGET} in
1212
# On 32-bit use a static relocation model which avoids some extra
@@ -85,27 +85,29 @@ esac
8585
# Arm specific
8686
case "${TARGET}" in
8787
aarch64-unknown-linux-gnu*|armv7-unknown-linux-gnueabihf*)
88-
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=info \
89-
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
88+
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
89+
cargo run "${INTRINSIC_TEST}" --release \
9090
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
9191
--runner "${TEST_RUNNER}" \
9292
--cppcompiler "${TEST_CXX_COMPILER}" \
9393
--skip "${TEST_SKIP_INTRINSICS}" \
9494
--target "${TARGET}" \
95+
--profile "${PROFILE}" \
9596
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
9697
;;
9798

9899
aarch64_be-unknown-linux-gnu*)
99-
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=info \
100-
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
100+
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
101+
cargo run "${INTRINSIC_TEST}" --release \
101102
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
102103
--runner "${TEST_RUNNER}" \
103104
--cppcompiler "${TEST_CXX_COMPILER}" \
104105
--skip "${TEST_SKIP_INTRINSICS}" \
105106
--target "${TARGET}" \
106-
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}" \
107+
--profile "${PROFILE}" \
107108
--linker "${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER}" \
108-
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}"
109+
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}" \
110+
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
109111
;;
110112

111113
x86_64-unknown-linux-gnu*)
@@ -114,13 +116,14 @@ case "${TARGET}" in
114116
# Hence the use of `env -u`.
115117
env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
116118
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" \
117-
RUST_LOG=info RUST_BACKTRACE=1 \
118-
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
119+
RUST_LOG=warn RUST_BACKTRACE=1 \
120+
cargo run "${INTRINSIC_TEST}" --release \
119121
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \
120122
--runner "${TEST_RUNNER}" \
121123
--skip "${TEST_SKIP_INTRINSICS}" \
122124
--cppcompiler "${TEST_CXX_COMPILER}" \
123125
--target "${TARGET}" \
126+
--profile "${PROFILE}" \
124127
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
125128
;;
126129
*)

ci/run-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ run() {
3737
--env NORUN \
3838
--env RUSTFLAGS \
3939
--env CARGO_UNSTABLE_BUILD_STD \
40+
--env PROFILE \
4041
--volume "${HOME}/.cargo":/cargo \
4142
--volume "$(rustc --print sysroot)":/rust:ro \
4243
--volume "$(pwd)":/checkout:ro \

ci/run.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set -ex
1212

1313
export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
1414
export HOST_RUSTFLAGS="${RUSTFLAGS}"
15-
export PROFILE="${PROFILE:="--profile=release"}"
15+
export PROFILE="${PROFILE:="release"}"
1616

1717
case ${TARGET} in
1818
# On Windows the linker performs identical COMDAT folding (ICF) by default
@@ -63,7 +63,7 @@ cargo_test() {
6363
if [ "$NORUN" = "1" ]; then
6464
export subcmd="build"
6565
fi
66-
cmd="$cmd ${subcmd} --target=$TARGET $1"
66+
cmd="$cmd ${subcmd} --target=$TARGET --profile=$PROFILE $1"
6767
cmd="$cmd -- $2"
6868

6969
case ${TARGET} in
@@ -80,10 +80,10 @@ cargo_test() {
8080
CORE_ARCH="--manifest-path=crates/core_arch/Cargo.toml"
8181
STDARCH_EXAMPLES="--manifest-path=examples/Cargo.toml"
8282

83-
cargo_test "${CORE_ARCH} ${PROFILE}"
83+
cargo_test "${CORE_ARCH}"
8484

8585
if [ "$NOSTD" != "1" ]; then
86-
cargo_test "${STDARCH_EXAMPLES} ${PROFILE}"
86+
cargo_test "${STDARCH_EXAMPLES}"
8787
fi
8888

8989

@@ -93,41 +93,41 @@ case ${TARGET} in
9393
export STDARCH_DISABLE_ASSERT_INSTR=1
9494

9595
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
96-
cargo_test "${PROFILE}"
96+
cargo_test
9797

9898
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx512f"
99-
cargo_test "${PROFILE}"
99+
cargo_test
100100
;;
101101
x86_64* | i686*)
102102
export STDARCH_DISABLE_ASSERT_INSTR=1
103103

104104
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
105-
cargo_test "${PROFILE}"
105+
cargo_test
106106
;;
107107
# FIXME: don't build anymore
108108
#mips-*gnu* | mipsel-*gnu*)
109109
# export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa,+fp64,+mips32r5"
110-
# cargo_test "${PROFILE}"
110+
# cargo_test
111111
# ;;
112112
mips64*)
113113
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa"
114-
cargo_test "${PROFILE}"
114+
cargo_test
115115
;;
116116
s390x*)
117117
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+vector-enhancements-1"
118-
cargo_test "${PROFILE}"
118+
cargo_test
119119
;;
120120
powerpc64*)
121121
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+altivec"
122-
cargo_test "${PROFILE}"
122+
cargo_test
123123

124124
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+vsx"
125-
cargo_test "${PROFILE}"
125+
cargo_test
126126
;;
127127
powerpc*)
128128
# qemu has a bug in PPC32 which leads to a crash when compiled with `vsx`
129129
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+altivec"
130-
cargo_test "${PROFILE}"
130+
cargo_test
131131
;;
132132
*)
133133
;;
@@ -138,7 +138,7 @@ if [ "$NORUN" != "1" ] && [ "$NOSTD" != 1 ]; then
138138
# Test examples
139139
(
140140
cd examples
141-
cargo test --target "$TARGET" "${PROFILE}"
142-
echo test | cargo run --target "$TARGET" "${PROFILE}" hex
141+
cargo test --target "${TARGET}" --profile "${PROFILE}"
142+
echo test | cargo run --target "${TARGET}" --profile "${PROFILE}" hex
143143
)
144144
fi

crates/intrinsic-test/src/common/cli.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ pub struct Cli {
4141
#[arg(long, default_value_t = String::from("armv7-unknown-linux-gnueabihf"))]
4242
pub target: String,
4343

44+
/// Pass a profile (release, dev)
45+
#[arg(long, default_value_t = String::from("release"))]
46+
pub profile: String,
47+
4448
/// Set the linker
4549
#[arg(long)]
4650
pub linker: Option<String>,
@@ -59,6 +63,7 @@ pub struct ProcessedCli {
5963
pub cpp_compiler: Option<String>,
6064
pub runner: String,
6165
pub target: String,
66+
pub profile: String,
6267
pub linker: Option<String>,
6368
pub cxx_toolchain_dir: Option<String>,
6469
pub skip: Vec<String>,
@@ -70,6 +75,7 @@ impl ProcessedCli {
7075
let filename = cli_options.input;
7176
let runner = cli_options.runner.unwrap_or_default();
7277
let target = cli_options.target;
78+
let profile = cli_options.profile;
7379
let linker = cli_options.linker;
7480
let cxx_toolchain_dir = cli_options.cxx_toolchain_dir;
7581
let sample_percentage = cli_options.sample_percentage;
@@ -103,6 +109,7 @@ impl ProcessedCli {
103109
cpp_compiler,
104110
runner,
105111
target,
112+
profile,
106113
linker,
107114
cxx_toolchain_dir,
108115
skip,

crates/intrinsic-test/src/common/compare.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@ fn runner_command(runner: &str) -> Command {
1111
cmd
1212
}
1313

14-
pub fn compare_outputs(intrinsic_name_list: &Vec<String>, runner: &str, target: &str) -> bool {
14+
pub fn compare_outputs(
15+
intrinsic_name_list: &Vec<String>,
16+
runner: &str,
17+
target: &str,
18+
profile: &str,
19+
) -> bool {
20+
let profile_dir = match profile {
21+
"dev" => "debug",
22+
_ => "release",
23+
};
24+
1525
let (c, rust) = rayon::join(
1626
|| {
1727
runner_command(runner)
@@ -21,7 +31,9 @@ pub fn compare_outputs(intrinsic_name_list: &Vec<String>, runner: &str, target:
2131
},
2232
|| {
2333
runner_command(runner)
24-
.arg(format!("./target/{target}/release/intrinsic-test-programs"))
34+
.arg(format!(
35+
"./target/{target}/{profile_dir}/intrinsic-test-programs"
36+
))
2537
.current_dir("rust_programs")
2638
.output()
2739
},

crates/intrinsic-test/src/common/gen_rust.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ pub fn write_lib_rs<T: IntrinsicTypeDefinition>(
140140
Ok(())
141141
}
142142

143-
pub fn compile_rust_programs(toolchain: Option<&str>, target: &str, linker: Option<&str>) -> bool {
143+
pub fn compile_rust_programs(
144+
toolchain: Option<&str>,
145+
target: &str,
146+
profile: &str,
147+
linker: Option<&str>,
148+
) -> bool {
144149
/* If there has been a linker explicitly set from the command line then
145150
* we want to set it via setting it in the RUSTFLAGS*/
146151

@@ -161,7 +166,7 @@ pub fn compile_rust_programs(toolchain: Option<&str>, target: &str, linker: Opti
161166
if toolchain.is_some_and(|val| !val.is_empty()) {
162167
cargo_command.arg(toolchain.unwrap());
163168
}
164-
cargo_command.args(["build", "--target", target, "--release"]);
169+
cargo_command.args(["build", "--target", target, "--profile", profile]);
165170

166171
let mut rust_flags = "-Cdebuginfo=0".to_string();
167172
if let Some(linker) = linker {

crates/intrinsic-test/src/common/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ pub trait SupportedArchitectureTest {
146146
.unwrap();
147147

148148
let target = &self.cli_options().target;
149+
let profile = &self.cli_options().profile;
149150
let toolchain = self.cli_options().toolchain.as_deref();
150151
let linker = self.cli_options().linker.as_deref();
151152

@@ -178,7 +179,7 @@ pub trait SupportedArchitectureTest {
178179
.collect::<Result<(), std::io::Error>>()
179180
.unwrap();
180181

181-
compile_rust_programs(toolchain, target, linker)
182+
compile_rust_programs(toolchain, target, profile, linker)
182183
}
183184

184185
fn compare_outputs(&self) -> bool {
@@ -193,6 +194,7 @@ pub trait SupportedArchitectureTest {
193194
&intrinsics_name_list,
194195
&self.cli_options().runner,
195196
&self.cli_options().target,
197+
&self.cli_options().profile,
196198
)
197199
} else {
198200
true

0 commit comments

Comments
 (0)