Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hermit][open-source] Add an extremely basic test script #25

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ jobs:
run: sudo apt-get install -y libunwind-dev
- name: Build
run: cargo build
- name: Run basic tests.
run: ./scripts/basic_oss_tests.sh
71 changes: 71 additions & 0 deletions scripts/basic_oss_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# The full hermit testing setup is Buck-based, and is not working in the OSS release yet.
# This extremely basic test harness is a stop-gap.

set -eEuo pipefail

cd "$(dirname $0)"
cd "../"

rootdir="$(pwd)"
hermit="$rootdir/target/debug/hermit"
hverify="$rootdir/target/debug/hermit-verify"

# Hello world smoke test:
"$hermit" run --no-rcb-time --preemption-timeout=disabled -- /bin/echo hello

function hermit_verify {
# Github Actions VMs don't expose the perf counters we need to use RCBs:
"$hverify" --hermit-bin="$hermit" run --isolate-workdir \
--hermit-arg="--base-env=empty" --hermit-arg="--env=HERMIT_MODE=strict" \
--hermit-arg="--no-rcb-time" --hermit-arg="--preemption-timeout=disabled" \
"$1"
}

for script in $(ls "$rootdir"/tests/shell/*.sh); do
echo; echo "Running shell test: $script"
hermit_verify "$script"
done

rust_tests=(
rustbin_bind_connect_race
rustbin_clock_gettime
rustbin_futex_timeout
rustbin_futex_wait_child
rustbin_heap_ptrs
rustbin_interrogate_tty
rustbin_nanosleep
rustbin_network_hello_world
rustbin_poll
rustbin_print_clock_nanosleep_monotonic_abs_race
rustbin_print_clock_nanosleep_monotonic_race
rustbin_print_clock_nanosleep_realtime_abs_race
rustbin_print_nanosleep_race
rustbin_rdtsc
rustbin_sched_yield
rustbin_socketpair
rustbin_stack_ptr
rustbin_thread_random
)
# Some tests don't work without RCB-timed based preemptions.
# rustbin_clock_total_order
# rustbin_exit_group
# rustbin_futex_and_print
# rustbin_futex_wake_some
# rustbin_mem_race
# rustbin_pipe_basics
# rustbin_poll_spin

for test in "${rust_tests[@]}";
do
echo; echo "Running rust test: $test"
file="$rootdir/target/debug/$test"
hermit_verify "$file"
done