diff options
Diffstat (limited to '58-run-CTS-soraka.sh')
-rwxr-xr-x | 58-run-CTS-soraka.sh | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/58-run-CTS-soraka.sh b/58-run-CTS-soraka.sh new file mode 100755 index 0000000..d315cc5 --- /dev/null +++ b/58-run-CTS-soraka.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# +# CTS Test runner +# +# This is a highly specific test to compile CTS in a pre-prepared CrOS-SDK with +# a pre-installed soraka-libcamera target. + +CROS=/home/kbingham/iob/libcamera/chromeos +CROS_CTS=$CROS/CTS/libcamera-cts +CROS_CTS_RESULTS=$CROS_CTS/results/ +CROS_LIBCAMERA=$CROS/src/third_party/libcamera + +source ./common.sh + +if [ ! -d $CROS_CTS ] ; +then + echo " [CTS] This test is highly customised to run on Kieran's Build Server" + echo " [CTS] Feel free to adapt if possible but otherwise this will skip..." + exit 0 +fi + +echo "Commencing CTS run" > $logfile + +kill_target() { + TARGET="$1" + + ssh $TARGET -C \ + "stop cros-camera; \ + killall cros_camera_service; \ + killall provider@2.4-service" +} + +prepare_target() { + TARGET="$1" + + # HACK: Clear space on our target. + # Cros deploy's don't clear up after themselves, + # so we'll do it here. + ssh $TARGET -C "rm -rf /usr/local/tmp/cros-deploy/tmp.*" + echo "Cleaned up cros deploy" + + echo "Killing targets" + kill_target "$TARGET" + + echo "Restarting cros-camera-service remotely..." + sleep 1; + ssh $TARGET -n -C \ + "ulimit -c unlimited; \ + killall -9 cros_camera_service; \ + cros_camera_service" 2>&1 >> $logfile & + sleep 1; +} + +run_cts() { + pushd $CROS_CTS + + echo "Waiting before saving prior crash results" + sleep 10; + + echo "Saving any prior crash results" + + ## Clear out any previous crash results + ./save-crash-reports.sh ./results/crash/ + + echo "Prior crash reports saved: About to run CTS in docker" + sleep 10; + + ./run-in-docker libcamera-cts ./run-cts.sh + #./run-in-docker libcamera-cts ./run-cts.sh "android.hardware.camera2.cts.NativeStillCaptureTest#testStillCapture" + #./run-in-docker libcamera-cts ./run-cts.sh android.hardware.cts.CameraTest + pass_fail $? "Run cts" + + ./save-cts-results.sh + #//rsync fails? Check me // pass_fail $? "Save CTS Results" + + popd +} + + +## Reset logging +echo "" > $logfile + +echo "Preparing target..." +prepare_target soraka >> $logfile +echo "Target prepared" + +## Something /after/ here causes a SIGSTOP +echo "Launching CTS..." +( run_cts ) >> $logfile + +echo "Cleaning up after CTS..." +# cleanup and close for logfiles after completion of CTS +kill_target soraka >> $logfile + +## Let everything settle after that... +sleep 1; + +# Save our current log file to the results +VERSION=$(libcamera_version "$CROS_LIBCAMERA") +LATEST=$(basename $(readlink -f $CROS_CTS_RESULTS/$VERSION/latest)) + +if [ -d $CROS_CTS_RESULTS/$VERSION/ ]; +then + cp $logfile $CROS_CTS_RESULTS/$VERSION/ + cp $logfile $CROS_CTS_RESULTS/$VERSION/$LATEST/ +fi + +sync + +report_results() { + grep "ModuleListener: .* fail:" $logfile + grep "Invocation finished" $logfile + echo "Results at https://results.uk.libcamera.org/$VERSION/$LATEST" +} + +report_results +#report_results | ./notify.sh + +RESULT_LINE=`grep "Invocation finished" $logfile` +./notify.sh "$RESULT_LINE \n\n Results at https://results.uk.libcamera.org/$VERSION/$LATEST" + +## Validate there are no failures in the log +## This is not ... complete ;-) +grep ", FAILED: 0, MODULES" $logfile +pass_fail $? "Verify there are no failures" + |