Skip to content

Commit

Permalink
Attempt to fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antoyo committed Jun 11, 2023
1 parent 4115e09 commit e74bc51
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
8 changes: 4 additions & 4 deletions build_sysroot/prepare_sysroot_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ git config user.name || git config user.name "None"

git commit -m "Initial commit" -q
for file in $(ls ../../patches/ | grep -v patcha); do
echo "[GIT] apply" $file
git apply ../../patches/$file
git add -A
git commit --no-gpg-sign -m "Patch $file"
echo "[GIT] apply" $file
git apply ../../patches/$file
git add -A
git commit --no-gpg-sign -m "Patch $file"
done
popd

Expand Down
9 changes: 7 additions & 2 deletions src/intrinsic/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
InvalidMonomorphizationReturnIntegerType { span, name, ret_ty, out_ty }
);

let arg1 = args[0].immediate();
// NOTE: we get different vector types for the same vector type and libgccjit doesn't
// compare them as equal, so bitcast.
// FIXME(antoyo): allow comparing vector types as equal in libgccjit.
let arg2 = bx.context.new_bitcast(None, args[1].immediate(), arg1.get_type());
return Ok(compare_simd_types(
bx,
args[0].immediate(),
args[1].immediate(),
arg1,
arg2,
in_elem,
llret_ty,
cmp_op,
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// FIXME: simple programs now segfault with a sysroot compile in release mode.

/*
* TODO(antoyo): implement equality in libgccjit based on https://zpz.github.io/blog/overloading-equality-operator-in-cpp-class-hierarchy/ (for type equality?)
* TODO(antoyo): support #[inline] attributes.
Expand Down
15 changes: 12 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,14 @@ function setup_rustc() {
rm config.toml || true

cat > config.toml <<EOF
changelog-seen = 2
[rust]
codegen-backends = []
deny-warnings = false
[build]
cargo = "$(which cargo)"
cargo = "$(rustup which cargo)"
local-rebuild = true
rustc = "$HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE/bin/rustc"
Expand All @@ -237,7 +239,7 @@ EOF
function asm_tests() {
setup_rustc

echo "[TEST] rustc test suite"
echo "[TEST] rustc asm test suite"
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"
COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 tests/assembly/asm --rustc-args "$RUSTC_ARGS"
}
Expand Down Expand Up @@ -351,7 +353,14 @@ function test_rustc() {
git checkout tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs
git checkout tests/ui/macros/rfc-2011-nicer-assert-messages/auxiliary/common.rs

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

RUSTC_ARGS="$TEST_FLAGS -Csymbol-mangling-version=v0 -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext""

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

0 comments on commit e74bc51

Please sign in to comment.