Skip to content

Commit 7e01c4c

Browse files
paulmckrcuJoel Fernandes
authored andcommitted
torture: Add testing of RCU's Rust bindings to torture.sh
This commit adds a --do-rcu-rust parameter to torture.sh, which invokes a rust_doctests_kernel kunit run. Note that kunit wants a clean source tree, so this runs "make mrproper", which might come as a surprise to some users. Should there be a --mrproper parameter to torture.sh to make the user explicitly ask for it? Co-developed-by: Boqun Feng <[email protected]> Signed-off-by: Boqun Feng <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Joel Fernandes <[email protected]>
1 parent fa11a54 commit 7e01c4c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tools/testing/selftests/rcutorture/bin/torture.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ do_clocksourcewd=yes
5959
do_rt=yes
6060
do_rcutasksflavors=yes
6161
do_srcu_lockdep=yes
62+
do_rcu_rust=no
6263

6364
# doyesno - Helper function for yes/no arguments
6465
function doyesno () {
@@ -89,6 +90,7 @@ usage () {
8990
echo " --do-rcutorture / --do-no-rcutorture / --no-rcutorture"
9091
echo " --do-refscale / --do-no-refscale / --no-refscale"
9192
echo " --do-rt / --do-no-rt / --no-rt"
93+
echo " --do-rcu-rust / --do-no-rcu-rust / --no-rcu-rust"
9294
echo " --do-scftorture / --do-no-scftorture / --no-scftorture"
9395
echo " --do-srcu-lockdep / --do-no-srcu-lockdep / --no-srcu-lockdep"
9496
echo " --duration [ <minutes> | <hours>h | <days>d ]"
@@ -191,6 +193,9 @@ do
191193
--do-rt|--do-no-rt|--no-rt)
192194
do_rt=`doyesno "$1" --do-rt`
193195
;;
196+
--do-rcu-rust|--do-no-rcu-rust|--no-rcu-rust)
197+
do_rcu_rust=`doyesno "$1" --do-rcu-rust`
198+
;;
194199
--do-scftorture|--do-no-scftorture|--no-scftorture)
195200
do_scftorture=`doyesno "$1" --do-scftorture`
196201
;;
@@ -485,6 +490,46 @@ then
485490
torture_set "rcurttorture-exp" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration "$duration_rcutorture" --configs "TREE03" --kconfig "CONFIG_PREEMPT_RT=y CONFIG_EXPERT=y CONFIG_HZ_PERIODIC=n CONFIG_NO_HZ_FULL=y CONFIG_RCU_NOCB_CPU=y" --trust-make
486491
fi
487492

493+
if test "$do_rcu_rust" = "yes"
494+
then
495+
echo " --- do-rcu-rust:" Start `date` | tee -a $T/log
496+
rrdir="tools/testing/selftests/rcutorture/res/$ds/results-rcu-rust"
497+
mkdir -p "$rrdir"
498+
echo " --- make LLVM=1 rustavailable " | tee -a $rrdir/log > $rrdir/rustavailable.out
499+
make LLVM=1 rustavailable > $T/rustavailable.out 2>&1
500+
retcode=$?
501+
echo $retcode > $rrdir/rustavailable.exitcode
502+
cat $T/rustavailable.out | tee -a $rrdir/log >> $rrdir/rustavailable.out 2>&1
503+
buildphase=rustavailable
504+
if test "$retcode" -eq 0
505+
then
506+
echo " --- Running 'make mrproper' in order to run kunit." | tee -a $rrdir/log > $rrdir/mrproper.out
507+
make mrproper > $rrdir/mrproper.out 2>&1
508+
retcode=$?
509+
echo $retcode > $rrdir/mrproper.exitcode
510+
buildphase=mrproper
511+
fi
512+
if test "$retcode" -eq 0
513+
then
514+
echo " --- Running rust_doctests_kernel." | tee -a $rrdir/log > $rrdir/rust_doctests_kernel.out
515+
./tools/testing/kunit/kunit.py run --make_options LLVM=1 --make_options CLIPPY=1 --arch arm64 --kconfig_add CONFIG_SMP=y --kconfig_add CONFIG_WERROR=y --kconfig_add CONFIG_RUST=y rust_doctests_kernel >> $rrdir/rust_doctests_kernel.out 2>&1
516+
# @@@ Remove "--arch arm64" in order to test on native architecture?
517+
# @@@ Analyze $rrdir/rust_doctests_kernel.out contents?
518+
retcode=$?
519+
echo $retcode > $rrdir/rust_doctests_kernel.exitcode
520+
buildphase=rust_doctests_kernel
521+
fi
522+
if test "$retcode" -eq 0
523+
then
524+
echo "rcu-rust($retcode)" $rrdir >> $T/successes
525+
echo Success >> $rrdir/log
526+
else
527+
echo "rcu-rust($retcode)" $rrdir >> $T/failures
528+
echo " --- rcu-rust Test summary:" >> $rrdir/log
529+
echo " --- Summary: Exit code $retcode from $buildphase, see $rrdir/$buildphase.out" >> $rrdir/log
530+
fi
531+
fi
532+
488533
if test "$do_srcu_lockdep" = "yes"
489534
then
490535
echo " --- do-srcu-lockdep:" Start `date` | tee -a $T/log

0 commit comments

Comments
 (0)