From bc6f9f64d87fe8d4015fcb468addccce26e59bbb Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 22 Nov 2018 14:13:11 +1100 Subject: [PATCH] Capture ramdisk test run logs I'm not sure why, but run_ramdisk_element_test is not using the same interface as run_disk_element_test, despite being called the same way. Update it so we are capturing logs. Change-Id: I41b6a3f2d6e5466b340677c6252b7646c1dc2663 --- tests/run_functests.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/run_functests.sh b/tests/run_functests.sh index 30c11c33..c8b83bd3 100755 --- a/tests/run_functests.sh +++ b/tests/run_functests.sh @@ -122,7 +122,7 @@ function logfile_status { mv "$filename" ${filename/.log/.$status.log} } -# run_disk_element_test +# run_disk_element_test # Run a disk-image-build build of ELEMENT including any elements # specified by TEST_ELEMENT. Pass OUTPUT_FORMAT to "-t" function run_disk_element_test() { @@ -198,28 +198,42 @@ function run_disk_element_test() { fi } -# run_ramdisk_element_test +# run_ramdisk_element_test # Run a disk-image-builder default build of ELEMENT including any # elements specified by TEST_ELEMENT function run_ramdisk_element_test() { local test_element=$1 local element=$2 + local dont_use_tmp=$3 + local output_format="$4" # ignored here + local logfile="$5" local dest_dir=$(mktemp -d) + local use_tmp_flag="" + if [ "${dont_use_tmp}" = "yes" ]; then + use_tmp_flag="--no-tmpfs" + fi + if ELEMENTS_PATH=$DIB_ELEMENTS/$element/test-elements \ - $DIB_CMD -x -o $dest_dir/image $element $test_element \ + $DIB_CMD -x -o ${dest_dir}/image \ + ${logfile} \ + ${use_tmp_flag} \ + ${element} ${test_element} 2>&1 \ | log_with_prefix "${element}/${test_element}"; then # TODO(dtantsur): test also kernel presence once we sort out its naming # problem (vmlinuz vs kernel) if ! [ -f "$dest_dir/image.initramfs" ]; then echo "Error: Build failed for element: $element, test-element: $test_element." echo "No image $dest_dir/image.initramfs found!" + logfile_status "FAIL" "${logfile}" exit 1 else echo "PASS: Element $element, test-element: $test_element" + logfile_status "PASS" "${logfile}" fi else echo "Error: Build failed for element: $element, test-element: $test_element." + logfile_status "FAIL" "${logfile}" exit 1 fi }