From 9d276b1abd9f495e2f15f8bfebb2152f63279fa3 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 10 May 2022 15:09:34 +0100 Subject: integration: Refactor CTS to support Soraka Split the Soraka preparation steps out ensuring the device is rebooted, and logged in to the test accounts. Signed-off-by: Kieran Bingham --- 56-build-libcamera-CTS.sh | 63 ----------------------- 56-prepare-soraka-CTS.sh | 47 +++++++++++++++++ 57-build-libcamera-CTS.sh | 63 +++++++++++++++++++++++ 57-run-CTS-soraka.sh | 128 ---------------------------------------------- 58-run-CTS-soraka.sh | 128 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 238 insertions(+), 191 deletions(-) delete mode 100755 56-build-libcamera-CTS.sh create mode 100755 56-prepare-soraka-CTS.sh create mode 100755 57-build-libcamera-CTS.sh delete mode 100755 57-run-CTS-soraka.sh create mode 100755 58-run-CTS-soraka.sh diff --git a/56-build-libcamera-CTS.sh b/56-build-libcamera-CTS.sh deleted file mode 100755 index ec23da4..0000000 --- a/56-build-libcamera-CTS.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/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/56-prepare-soraka-CTS.sh b/56-prepare-soraka-CTS.sh new file mode 100755 index 0000000..20f880e --- /dev/null +++ b/56-prepare-soraka-CTS.sh @@ -0,0 +1,47 @@ +#!/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 "Preparing Soraka for CTS" > $logfile + +## Reboot the soraka + +ssh soraka reboot +sleep 1 + +## Wait for it to come back alive and respond to pings +until nc -zw 1 -v soraka 22; do + sleep 5 +done + +## Log in +login_soraka() { + echo "Preparing Soraka for CTS..." + + ( sudo $CROS/chromite/bin/cros_sdk tast run soraka arc.Boot ) 2>&1 + pass_fail $? "Logging into Soraka" +} + +login_soraka >> $logfile + +echo "Soraka logged in and prepared for CTS." + diff --git a/57-build-libcamera-CTS.sh b/57-build-libcamera-CTS.sh new file mode 100755 index 0000000..ec23da4 --- /dev/null +++ b/57-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 deleted file mode 100755 index d315cc5..0000000 --- a/57-run-CTS-soraka.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/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" - 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" + -- cgit v1.2.1