<commit_before>#!/bin/bash

# Note: this assumes that the images have all been built and the current working
# directory is the root of the repo.

# Fail on any error.
set -e
# Display commands being run.
set -x

TIMEOUT="timeout --foreground"
OUT="out/aarch64/qemu"
HFTEST="$TIMEOUT 30s ./test/vm/hftest.py --out $OUT/clang_aarch64 --initrd"

# Run the host unit tests
mkdir -p $OUT/clang_mock_arch/test_log/unit_tests
$TIMEOUT 30s $OUT/clang_mock_arch/unit_tests \
  --gtest_output="xml:$OUT/clang_mock_arch/test_log/unit_tests/sponge_log.xml" \
  | tee $OUT/clang_mock_arch/test_log/unit_tests/sponge_log.log

# Run the tests with a timeout so they can't loop forever.
$HFTEST primary_only_test
$HFTEST primary_with_secondary_test<commit_msg>Make test script fail if unit tests fail.<commit_after>#!/bin/bash

# Note: this assumes that the images have all been built and the current working
# directory is the root of the repo.

# Fail on any error.
set -e
# Fail on any part of a pipeline failing.
set -o pipefail
# Treat unset variables as an error
set -u
# Display commands being run.
set -x

TIMEOUT="timeout --foreground"
OUT="out/aarch64/qemu"
HFTEST="$TIMEOUT 30s ./test/vm/hftest.py --out $OUT/clang_aarch64 --initrd"

# Run the host unit tests
mkdir -p $OUT/clang_mock_arch/test_log/unit_tests
$TIMEOUT 30s $OUT/clang_mock_arch/unit_tests \
  --gtest_output="xml:$OUT/clang_mock_arch/test_log/unit_tests/sponge_log.xml" \
  | tee $OUT/clang_mock_arch/test_log/unit_tests/sponge_log.log

# Run the tests with a timeout so they can't loop forever.
$HFTEST primary_only_test
$HFTEST primary_with_secondary_test
{'fraction_non_alphanumeric': 0.10006176652254478, 'fraction_numerical': 0.009882643607164917, 'mean_word_length': 4.491525423728813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6398598', 'n_tokens_mistral': 599, 'n_tokens_neox': 574, 'n_words': 169}