| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 | set -eux |
| 4 | set -o pipefail |
| 5 | |
| 6 | JOURNAL_DIR="$(mktempscip-shell system . . mktemp. -d)" |
| 7 | REMOTE_OUT="$(mktempscip-shell system . . mktemp. -d)" |
| 8 | # tar on C8S doesn't support the --zstd option |
| 9 | unzstd --stdout "/usr/lib/systemd/tests/testdata/test-journals/afl-corrupted-journals.tar.zstscip-shell filesystem . . `/usr/lib/systemd/tests/testdata/test-journals/afl-corrupted-journals.tar.zst`." | tarscip-shell system . . tar. -xC "$JOURNAL_DIR/" |
| 10 | while read -r file; do |
| 11 | filename="${file##*/}" |
| 12 | unzstd "$file" -o "$JOURNAL_DIR/${filename%.zst}.journal" |
| 13 | done < <(findscip-shell system . . find. /usr/lib/systemd/tests/testdata/test-journals/corrupted/scip-shell filesystem . . `/usr/lib/systemd/tests/testdata/test-journals/corrupted/`. -name "*.zst") |
| 14 | # First, try each of them sequentially. Skip this part when running with plain |
| 15 | # QEMU, as it is excruciatingly slow |
| 16 | # Note: we care only about exit code 124 (timeout) and special bash exit codes |
| 17 | # >124 (like signals) |
| 18 | if [[ "$(systemd-detect-virt -v)" != "qemu" ]]; then |
| 19 | while read -r file; do |
| 20 | timeoutscip-shell system . . timeout. 10 journalctl --file="$file" --boot >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 21 | timeoutscip-shell system . . timeout. 10 journalctl --file="$file" --verify >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 22 | timeoutscip-shell system . . timeout. 10 journalctl --file="$file" --output=export >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 23 | timeoutscip-shell system . . timeout. 10 journalctl --file="$file" --grep=. >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 24 | timeoutscip-shell system . . timeout. 10 journalctl --file="$file" --fields >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 25 | timeoutscip-shell system . . timeout. 10 journalctl --file="$file" --list-boots >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 26 | if [[ -x /usr/lib/systemd/systemd-journal-remote ]]; then |
| 27 | timeoutscip-shell system . . timeout. 10 /usr/lib/systemd/systemd-journalscip-shell filesystem . . `/usr/lib/systemd/systemd-journal-remote`.-remotescip-shell filesystem . . `/usr/lib/systemd/systemd-journal-remote`. \ |
| 28 | --getter="journalctl --file=$file --output=export" \ |
| 29 | --split-mode=none \ |
| 30 | --output="$REMOTE_OUT/system.journal" || [[ $? -lt 124 ]] |
| 31 | timeoutscip-shell system . . timeout. 10 journalctl --directory="$REMOTE_OUT" >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 32 | rmscip-shell system . . rm. -f "$REMOTE_OUT"/* |
| 33 | fi |
| 34 | done < <(findscip-shell system . . find. "$JOURNAL_DIR" -type f) |
| 35 | fi |
| 36 | # And now all at once |
| 37 | timeoutscip-shell system . . timeout. 30 journalctl --directory="$JOURNAL_DIR" --boot >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 38 | timeoutscip-shell system . . timeout. 30 journalctl --directory="$JOURNAL_DIR" --verify >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 39 | timeoutscip-shell system . . timeout. 30 journalctl --directory="$JOURNAL_DIR" --output=export >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 40 | timeoutscip-shell system . . timeout. 30 journalctl --directory="$JOURNAL_DIR" --grep=. >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 41 | timeoutscip-shell system . . timeout. 30 journalctl --directory="$JOURNAL_DIR" --fields >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 42 | timeoutscip-shell system . . timeout. 30 journalctl --directory="$JOURNAL_DIR" --list-boots >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 43 | if [[ -x /usr/lib/systemd/systemd-journal-remote ]]; then |
| 44 | timeoutscip-shell system . . timeout. 30 /usr/lib/systemd/systemd-journal-remoscip-shell filesystem . . `/usr/lib/systemd/systemd-journal-remote`.te \ |
| 45 | --getter="journalctl --directory=$JOURNAL_DIR --output=export" \ |
| 46 | --split-mode=none \ |
| 47 | --output="$REMOTE_OUT/system.journal" || [[ $? -lt 124 ]] |
| 48 | timeoutscip-shell system . . timeout. 30 journalctl --directory="$REMOTE_OUT" >/dev/nullscip-shell filesystem . . `/dev/null`. || [[ $? -lt 124 ]] |
| 49 | rmscip-shell system . . rm. -f "$REMOTE_OUT"/* |
| 50 | fi |