Add the kunit_test tests to the presubmit.
This change updates 'kunit.sh' to run both the kunit_test and kunit
tests. These are run independently, but both need to pass for the
presubmit as a whole to pass.
Note that, unlike for the KUnit tests, the test output for these tests
is only printed on failure.
Google-Bug-Id: 129375192
Change-Id: I1ffb8ae8a7de3ca13bc365b980a5bbb818b2a8f7
Signed-off-by: David Gow <davidgow@google.com>
diff --git a/kunit.sh b/kunit.sh
index 8a30d61..4c2a605 100755
--- a/kunit.sh
+++ b/kunit.sh
@@ -21,20 +21,32 @@
# Include kunitconfig manually until we can pull it from prowjob TODO(avikr)
cp /kunitconfig ./kunitconfig
+# Run the KUnit tool unit tests
+python3 ./tools/testing/kunit/kunit_test.py > "$ARTIFACTS/kunit_test.log" 2>&1
+KUNIT_TEST_EXIT_CODE=$?
+
# Build and run kernel, parse output, and send details to output log
python3 ./tools/testing/kunit/kunit.py run > "$ARTIFACTS/kunit.log" 2>&1
-EXIT_CODE=$?
+KUNIT_EXIT_CODE=$?
-if [[ $EXIT_CODE -ne 0 ]]; then
+if [[ $KUNIT_TEST_EXIT_CODE -ne 0 ]]; then
+ echo "KUnit Tool Presubmit Failed:"
+ echo "============================="
+ cat "$ARTIFACTS/kunit_test.log"
+ echo "============================="
+fi
+
+echo
+
+if [[ $KUNIT_EXIT_CODE -ne 0 ]]; then
echo "KUnit Presubmit Failed:"
else
echo "KUnit Presubmit Succeeded:"
fi
-
echo "============================="
cat "$ARTIFACTS/kunit.log"
echo "============================="
-if [[ $EXIT_CODE -ne 0 ]]; then
+if [[ $KUNIT_TEST_EXIT_CODE -ne 0 || $KUNIT_EXIT_CODE -ne 0 ]]; then
exit 1
fi