From 19500b3dbf3f0f53b15d85ef9864aa9fde4e5d39 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Mon, 13 Dec 2021 11:25:41 +0000 Subject: CTS: 56:57: Build and Test with CTS Signed-off-by: Kieran Bingham --- 56-build-libcamera-CTS.sh | 63 +++++++++++++++++++++++ 57-run-CTS-soraka.sh | 128 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+) create mode 100755 56-build-libcamera-CTS.sh create mode 100755 57-run-CTS-soraka.sh diff --git a/56-build-libcamera-CTS.sh b/56-build-libcamera-CTS.sh new file mode 100755 index 0000000..ec23da4 --- /dev/null +++ b/56-build-libcamera-CTS.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# +# CTS Tree builder +# +# 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 Build for CTS" > $logfile + +LIBCAMERA=${1:-$(srcdir libcamera)} + +if [ ! -d $LIBCAMERA ] ; +then + fail "A valid libcamera tree is required to test" + # No return from fail +fi + + +## Install 'our' version of libcamera + +update_sources() { + # Check existing link + ls -alh $CROS_LIBCAMERA + + # Sync our version to libcamera-integration + rsync -av $LIBCAMERA/ $CROS_LIBCAMERA-integration/ + pass_fail $? "Synchronise sources to chrome SDK" + + unlink $CROS_LIBCAMERA + ln -s libcamera-integration $CROS_LIBCAMERA + ls -alh $CROS_LIBCAMERA +} + +build_libcamera() { + echo "Building and installing libcamera on the Soraka..." + # A custom Makefile is inside the chroot to simplify this step + + ( sudo $CROS/chromite/bin/cros_sdk make libcamera-clean libcamera ) 2>&1 + pass_fail $? "Install libcamera on Soraka" +} + + +update_sources > $logfile +echo "Updated sources" +build_libcamera >> $logfile +echo "Finished building libcamera" + diff --git a/57-run-CTS-soraka.sh b/57-run-CTS-soraka.sh new file mode 100755 index 0000000..d315cc5 --- /dev/null +++ b/57-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" + -- cgit v1.2.1