Skip to content

Commit e74bc51

Browse files
committed
Attempt to fix the tests
1 parent 4115e09 commit e74bc51

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

build_sysroot/prepare_sysroot_src.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ git config user.name || git config user.name "None"
2929

3030
git commit -m "Initial commit" -q
3131
for file in $(ls ../../patches/ | grep -v patcha); do
32-
echo "[GIT] apply" $file
33-
git apply ../../patches/$file
34-
git add -A
35-
git commit --no-gpg-sign -m "Patch $file"
32+
echo "[GIT] apply" $file
33+
git apply ../../patches/$file
34+
git add -A
35+
git commit --no-gpg-sign -m "Patch $file"
3636
done
3737
popd
3838

src/intrinsic/simd.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
165165
InvalidMonomorphizationReturnIntegerType { span, name, ret_ty, out_ty }
166166
);
167167

168+
let arg1 = args[0].immediate();
169+
// NOTE: we get different vector types for the same vector type and libgccjit doesn't
170+
// compare them as equal, so bitcast.
171+
// FIXME(antoyo): allow comparing vector types as equal in libgccjit.
172+
let arg2 = bx.context.new_bitcast(None, args[1].immediate(), arg1.get_type());
168173
return Ok(compare_simd_types(
169174
bx,
170-
args[0].immediate(),
171-
args[1].immediate(),
175+
arg1,
176+
arg2,
172177
in_elem,
173178
llret_ty,
174179
cmp_op,

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// FIXME: simple programs now segfault with a sysroot compile in release mode.
2+
13
/*
24
* TODO(antoyo): implement equality in libgccjit based on https://zpz.github.io/blog/overloading-equality-operator-in-cpp-class-hierarchy/ (for type equality?)
35
* TODO(antoyo): support #[inline] attributes.

test.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,14 @@ function setup_rustc() {
214214
rm config.toml || true
215215

216216
cat > config.toml <<EOF
217+
changelog-seen = 2
218+
217219
[rust]
218220
codegen-backends = []
219221
deny-warnings = false
220222
221223
[build]
222-
cargo = "$(which cargo)"
224+
cargo = "$(rustup which cargo)"
223225
local-rebuild = true
224226
rustc = "$HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE/bin/rustc"
225227
@@ -237,7 +239,7 @@ EOF
237239
function asm_tests() {
238240
setup_rustc
239241

240-
echo "[TEST] rustc test suite"
242+
echo "[TEST] rustc asm test suite"
241243
RUSTC_ARGS="-Zpanic-abort-tests -Csymbol-mangling-version=v0 -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext" --sysroot "$(pwd)"/../build_sysroot/sysroot -Cpanic=abort"
242244
COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 tests/assembly/asm --rustc-args "$RUSTC_ARGS"
243245
}
@@ -351,7 +353,14 @@ function test_rustc() {
351353
git checkout tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs
352354
git checkout tests/ui/macros/rfc-2011-nicer-assert-messages/auxiliary/common.rs
353355

354-
RUSTC_ARGS="$TEST_FLAGS -Csymbol-mangling-version=v0 -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext" --sysroot "$(pwd)"/../build_sysroot/sysroot"
356+
# We need to overwrite the sysroot in the tests, now.
357+
# TODO(antoyo): find a faster way to do this.
358+
# FIXME: this makes the stderr different since it changes the line numbers.
359+
for file in $(find tests/ui -type f -name '*.rs'); do
360+
sed -ie "1i // compile-flags: --sysroot "$(pwd)"/../build_sysroot/sysroot\n" $file
361+
done
362+
363+
RUSTC_ARGS="$TEST_FLAGS -Csymbol-mangling-version=v0 -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext""
355364

356365
if [ $# -eq 0 ]; then
357366
# No argument supplied to the function. Doing nothing.

0 commit comments

Comments
 (0)