Skip to content

Commit e960b8c

Browse files
committed
Modifies CI to pass profile to test tool
1 parent 4a24a85 commit e960b8c

File tree

9 files changed

+56
-27
lines changed

9 files changed

+56
-27
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: 8 additions & 5 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
@@ -83,22 +83,24 @@ esac
8383
case "${TARGET}" in
8484
aarch64-unknown-linux-gnu*|armv7-unknown-linux-gnueabihf*)
8585
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
86-
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
86+
cargo run "${INTRINSIC_TEST}" --release \
8787
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
8888
--runner "${TEST_RUNNER}" \
8989
--cppcompiler "${TEST_CXX_COMPILER}" \
9090
--skip "${TEST_SKIP_INTRINSICS}" \
91-
--target "${TARGET}"
91+
--target "${TARGET}" \
92+
--profile "${PROFILE}"
9293
;;
9394

9495
aarch64_be-unknown-linux-gnu*)
9596
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
96-
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
97+
cargo run "${INTRINSIC_TEST}" --release \
9798
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
9899
--runner "${TEST_RUNNER}" \
99100
--cppcompiler "${TEST_CXX_COMPILER}" \
100101
--skip "${TEST_SKIP_INTRINSICS}" \
101102
--target "${TARGET}" \
103+
--profile "${PROFILE}" \
102104
--linker "${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER}" \
103105
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}"
104106
;;
@@ -110,11 +112,12 @@ case "${TARGET}" in
110112
env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
111113
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" \
112114
RUST_LOG=warn RUST_BACKTRACE=1 \
113-
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
115+
cargo run "${INTRINSIC_TEST}" --release \
114116
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \
115117
--runner "${TEST_RUNNER}" \
116118
--skip "${TEST_SKIP_INTRINSICS}" \
117119
--cppcompiler "${TEST_CXX_COMPILER}" \
120+
--profile "${PROFILE}" \
118121
--target "${TARGET}" \
119122
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
120123
;;

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
@@ -47,6 +47,10 @@ pub struct Cli {
4747
#[arg(long, default_value_t = String::from("armv7-unknown-linux-gnueabihf"))]
4848
pub target: String,
4949

50+
/// Pass a profile (release, dev)
51+
#[arg(long, default_value_t = String::from("release"))]
52+
pub profile: String,
53+
5054
/// Set the linker
5155
#[arg(long)]
5256
pub linker: Option<String>,
@@ -65,6 +69,7 @@ pub struct ProcessedCli {
6569
pub cpp_compiler: Option<String>,
6670
pub runner: String,
6771
pub target: String,
72+
pub profile: String,
6873
pub linker: Option<String>,
6974
pub cxx_toolchain_dir: Option<String>,
7075
pub skip: Vec<String>,
@@ -76,6 +81,7 @@ impl ProcessedCli {
7681
let filename = cli_options.input;
7782
let runner = cli_options.runner.unwrap_or_default();
7883
let target = cli_options.target;
84+
let profile = cli_options.profile;
7985
let linker = cli_options.linker;
8086
let cxx_toolchain_dir = cli_options.cxx_toolchain_dir;
8187
let sample_percentage = cli_options.sample_percentage;
@@ -109,6 +115,7 @@ impl ProcessedCli {
109115
cpp_compiler,
110116
runner,
111117
target,
118+
profile,
112119
linker,
113120
cxx_toolchain_dir,
114121
skip,

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

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

13-
pub fn compare_outputs(intrinsic_name_list: &Vec<String>, runner: &str, target: &str) -> bool {
13+
pub fn compare_outputs(
14+
intrinsic_name_list: &Vec<String>,
15+
runner: &str,
16+
target: &str,
17+
profile: &str,
18+
) -> bool {
1419
let intrinsics = intrinsic_name_list
1520
.par_iter()
1621
.filter_map(|intrinsic_name| {
@@ -20,8 +25,13 @@ pub fn compare_outputs(intrinsic_name_list: &Vec<String>, runner: &str, target:
2025
.current_dir("c_programs")
2126
.output();
2227

28+
let profile_dir = match profile {
29+
"dev" => "debug",
30+
_ => "release",
31+
};
32+
2333
let rust = runner_command(runner)
24-
.arg(format!("./target/{target}/release/intrinsic-test-programs"))
34+
.arg(format!("./target/{target}/{profile_dir}/intrinsic-test-programs"))
2535
.arg(intrinsic_name)
2636
.current_dir("rust_programs")
2737
.output();

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ pub fn write_lib_rs<T: IntrinsicTypeDefinition>(
125125
Ok(())
126126
}
127127

128-
pub fn compile_rust_programs(toolchain: Option<&str>, target: &str, linker: Option<&str>) -> bool {
128+
pub fn compile_rust_programs(
129+
toolchain: Option<&str>,
130+
target: &str,
131+
profile: &str,
132+
linker: Option<&str>,
133+
) -> bool {
129134
/* If there has been a linker explicitly set from the command line then
130135
* we want to set it via setting it in the RUSTFLAGS*/
131136

@@ -146,7 +151,7 @@ pub fn compile_rust_programs(toolchain: Option<&str>, target: &str, linker: Opti
146151
if toolchain.is_some_and(|val| !val.is_empty()) {
147152
cargo_command.arg(toolchain.unwrap());
148153
}
149-
cargo_command.args(["build", "--target", target, "--release"]);
154+
cargo_command.args(["build", "--target", target, "--profile", profile]);
150155

151156
let mut rust_flags = "-Cdebuginfo=0".to_string();
152157
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
@@ -142,6 +142,7 @@ pub trait SupportedArchitectureTest {
142142
.unwrap();
143143

144144
let target = &self.cli_options().target;
145+
let profile = &self.cli_options().profile;
145146
let toolchain = self.cli_options().toolchain.as_deref();
146147
let linker = self.cli_options().linker.as_deref();
147148

@@ -174,7 +175,7 @@ pub trait SupportedArchitectureTest {
174175
.collect::<Result<(), std::io::Error>>()
175176
.unwrap();
176177

177-
compile_rust_programs(toolchain, target, linker)
178+
compile_rust_programs(toolchain, target, profile, linker)
178179
}
179180

180181
fn compare_outputs(&self) -> bool {
@@ -189,6 +190,7 @@ pub trait SupportedArchitectureTest {
189190
&intrinsics_name_list,
190191
&self.cli_options().runner,
191192
&self.cli_options().target,
193+
&self.cli_options().profile,
192194
)
193195
} else {
194196
true

0 commit comments

Comments
 (0)