Skip to content

Commit

Permalink
Install lib source, update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Oct 6, 2023
1 parent e66c6e3 commit fcf463d
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 133 deletions.
124 changes: 62 additions & 62 deletions .github/workflows/ci-miri.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,72 +11,72 @@ on:
- cron: '00 2 * * *' # At 02:00 UTC every day (like rustup-components-history).

jobs:
test-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup environment
run: bash ./ci-miri-setup.sh
- name: Test
run: bash ./ci-miri-test.sh core
# test-core:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup environment
# run: bash ./ci-miri-setup.sh
# - name: Test
# run: bash ./ci-miri-test.sh core

test-alloc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup environment
run: bash ./ci-miri-setup.sh
- name: Test
run: bash ./ci-miri-test.sh alloc
# test-alloc:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup environment
# run: bash ./ci-miri-setup.sh
# - name: Test
# run: bash ./ci-miri-test.sh alloc

test-std:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup environment
run: bash ./ci-miri-setup.sh
- name: Test
run: bash ./ci-miri-test.sh std
# test-std:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup environment
# run: bash ./ci-miri-setup.sh
# - name: Test
# run: bash ./ci-miri-test.sh std

test-simd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup environment
run: bash ./ci-miri-setup.sh
- name: Test
run: bash ./ci-miri-test.sh simd
# test-simd:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup environment
# run: bash ./ci-miri-setup.sh
# - name: Test
# run: bash ./ci-miri-test.sh simd

test-stdarch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup environment
run: bash ./ci-miri-setup.sh
- name: Test
run: bash ./ci-miri-test.sh stdarch
# test-stdarch:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup environment
# run: bash ./ci-miri-setup.sh
# - name: Test
# run: bash ./ci-miri-test.sh stdarch

# Send a Zulip notification when a cron job fails
cron-fail-notify:
name: cronjob failure notification
runs-on: ubuntu-latest
needs: [test-core, test-alloc, test-std, test-simd]
if: github.event_name == 'schedule' && (failure() || cancelled())
steps:
- name: Install zulip-send
run: pip3 install zulip
- name: Send Zulip notification
shell: bash
env:
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
run: |
~/.local/bin/zulip-send --stream miri --subject "Cron Job Failure (miri-test-libstd, $(date -u +%Y-%m))" \
--message 'Dear @*T-miri*,
# # Send a Zulip notification when a cron job fails
# cron-fail-notify:
# name: cronjob failure notification
# runs-on: ubuntu-latest
# needs: [test-core, test-alloc, test-std, test-simd]
# if: github.event_name == 'schedule' && (failure() || cancelled())
# steps:
# - name: Install zulip-send
# run: pip3 install zulip
# - name: Send Zulip notification
# shell: bash
# env:
# ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
# ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
# run: |
# ~/.local/bin/zulip-send --stream miri --subject "Cron Job Failure (miri-test-libstd, $(date -u +%Y-%m))" \
# --message 'Dear @*T-miri*,

The standard library test suite is [failing under Miri]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"'). Would you mind investigating this issue?
# The standard library test suite is [failing under Miri]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"'). Would you mind investigating this issue?

Thanks in advance!
Sincerely,
The Miri Cronjobs Bot' \
--user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com
# Thanks in advance!
# Sincerely,
# The Miri Cronjobs Bot' \
# --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com
2 changes: 1 addition & 1 deletion ci-sanitizers-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ else
RUST_TOOLCHAIN=$(cat rust-version)
fi
echo "Installing Rust version: $RUST_TOOLCHAIN"
rustup toolchain install "$RUST_TOOLCHAIN"
rustup toolchain install "$RUST_TOOLCHAIN" --components rust-src
rustup override set "$RUST_TOOLCHAIN"
125 changes: 55 additions & 70 deletions ci-sanitizers-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ set -eauxo pipefail

DEFAULTFLAGS="-Zrandomize-layout"

if [ -Z "${TARGET+x}" ]; then
echo "Env TARGET must be set"
exit 1
fi

# apply our patch
rm -rf rust-src-patched
cp -a "$(rustc --print sysroot)/lib/rustlib/src/rust/" rust-src-patched
Expand Down Expand Up @@ -63,46 +68,38 @@ thread)
exit 1
esac

export RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS"

echo "Running tests with sanitizer=$SANITIZER on target $TARGET"

# run the tests (some also without validation, to exercise those code paths in Miri)
case "$1" in
core)
# A 64bit little-endian and a 32bit big-endian target.
# (Varying the OS is totally pointless for core.)
for TARGET in x86_64-unknown-linux-gnu mips-unknown-linux-gnu; do
echo "::group::Testing core ($TARGET, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh core --target $TARGET --lib --tests \
-- --skip align \
2>&1 | ts -i '%.s '
echo "::endgroup::"
echo "::group::Testing core ($TARGET, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh core --target $TARGET --lib --tests \
2>&1 | ts -i '%.s '
echo "::endgroup::"
echo "::group::Testing core docs ($TARGET, $SANITIZER)" && echo
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh core --target $TARGET --doc \
2>&1 | ts -i '%.s '
echo "::endgroup::"
done
echo "::group::Testing core"
./run-test.sh core --target "$TARGET" --lib --tests -- --skip align \
2>&1 | ts -i '%.s '
echo "::endgroup::"

echo "::group::Testing core"
./run-test.sh core --target "$TARGET" --lib --tests \
2>&1 | ts -i '%.s '
echo "::endgroup::"

echo "::group::Testing core docs" && echo
./run-test.sh core --target "$TARGET" --doc \
2>&1 | ts -i '%.s '
echo "::endgroup::"
;;
alloc)
# A 64bit little-endian and a 32bit big-endian target.
# (Varying the OS is not really worth it for alloc.)
for TARGET in x86_64-unknown-linux-gnu mips-unknown-linux-gnu; do
echo "::group::Testing alloc ($SANITIZER, $TARGET, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh alloc --target $TARGET --lib --tests \
2>&1 | ts -i '%.s '
echo "::endgroup::"
echo "::group::Testing alloc docs ($TARGET, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh alloc --target $TARGET --doc \
2>&1 | ts -i '%.s '
echo "::endgroup::"
done
echo "::group::Testing alloc"
./run-test.sh alloc --target "$TARGET" --lib --tests \
2>&1 | ts -i '%.s '
echo "::endgroup::"

echo "::group::Testing alloc docs"
./run-test.sh alloc --target "$TARGET" --doc \
2>&1 | ts -i '%.s '
echo "::endgroup::"
;;
std)
# Modules that we skip entirely, because they need a lot of shims we don't support.
Expand All @@ -111,62 +108,50 @@ std)
# These are the most OS-specific (among the modules we do not skip).
CORE="time:: sync:: thread:: env::"

for TARGET in x86_64-unknown-linux-gnu aarch64-apple-darwin x86_64-pc-windows-msvc i686-pc-windows-gnu; do
echo "::group::Testing std core ($CORE on $TARGET)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh std --target $TARGET --lib --tests \
-- $CORE \
2>&1 | ts -i '%.s '
echo "::endgroup::"
echo "::group::Testing std core docs ($CORE on $TARGET, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh std --target $TARGET --doc \
-- $CORE \
2>&1 | ts -i '%.s '
echo "::endgroup::"
done
echo "::group::Testing std core ($CORE on $TARGET)"
./run-test.sh std --target "$TARGET" --lib --tests \
-- $CORE \
2>&1 | ts -i '%.s '
echo "::endgroup::"

echo "::group::Testing std core docs ($CORE on $TARGET, $SANITIZER)"
./run-test.sh std --target "$TARGET" --doc \
-- $CORE \
2>&1 | ts -i '%.s '
echo "::endgroup::"

# "sleep" has a thread leak that we have to ignore
echo "::group::Testing remaining std (all except for $SKIP, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh std --lib --tests \
-- $(for M in $CORE; do echo "--skip $M "; done) $(for M in $SKIP; do echo "--skip $M "; done) \
2>&1 | ts -i '%.s '
# -- $(for M in $CORE; do echo "--skip $M "; done) $(for M in $SKIP; do echo "--skip $M "; done) \
echo "::endgroup::"

echo "::group::Testing remaining std docs (all except for $SKIP, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-test.sh std --doc \
-- $(for M in $CORE; do echo "--skip $M "; done) $(for M in $SKIP; do echo "--skip $M "; done) \
2>&1 | ts -i '%.s '
# -- $(for M in $CORE; do echo "--skip $M "; done) $(for M in $SKIP; do echo "--skip $M "; done) \
echo "::endgroup::"
;;
simd)
cd $LIB_SRC/portable-simd
export RUSTFLAGS="-Ainternal_features ${RUSTFLAGS:-}"
cd "$LIB_SRC/portable-simd"
export RUSTFLAGS="-Ainternal_features ${RUSTFLAGS}"
export RUSTDOCFLAGS="-Ainternal_features ${RUSTDOCFLAGS:-}"

echo "::group::Testing portable-simd"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
cargo miri test --lib --tests -- --skip ptr \
2>&1 | ts -i '%.s '
cargo test --lib --tests -- --skip ptr 2>&1 | ts -i '%.s '
# This contains some pointer tests that do int/ptr casts, so we need permissive provenance.
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
cargo miri test --lib --tests -- ptr \
2>&1 | ts -i '%.s '
cargo test --lib --tests -- ptr 2>&1 | ts -i '%.s '
echo "::endgroup::"

echo "::group::Testing portable-simd docs"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
cargo miri test --doc \
2>&1 | ts -i '%.s '
cargo test --doc 2>&1 | ts -i '%.s '
echo "::endgroup::"
;;
stdarch)
for TARGET in x86_64-unknown-linux-gnu i686-unknown-linux-gnu; do
echo "::group::Testing stdarch ($TARGET, $SANITIZER)"
RUSTFLAGS="$DEFAULTFLAGS -Zsanitizer=$SANITIZER $EXTRAFLAGS" \
./run-stdarch-test.sh $TARGET \
2>&1 | ts -i '%.s '
echo "::endgroup::"
done
echo "::group::Testing stdarch"
./run-stdarch-test.sh "$TARGET" 2>&1 | ts -i '%.s '
echo "::endgroup::"
;;
*)
echo "Unknown command"
Expand Down

0 comments on commit fcf463d

Please sign in to comment.