Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions autorun/autorun0
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,22 @@ find_results_partition() {

setup_results_dir() {
local part
if part="$(find_results_partition)"; then
if [[ -n "${RESULTS_DIR:-}" ]]; then
# Explicitly configured via config/default.env.
:
elif part="$(find_results_partition)"; then
RESULTS_DIR="${part}/results"
# Remount rw if we landed on a read-only mount
mount -o remount,rw "$part" 2> /dev/null || true
else
log "WARN: no writable FAT32 partition found; results will live in tmpfs (/run/results) and will NOT survive reboot"
RESULTS_DIR=/run/results
fi
mkdir -p "$RESULTS_DIR"
if ! mkdir -p "$RESULTS_DIR" 2> /dev/null; then
log "WARN: could not create RESULTS_DIR=$RESULTS_DIR; falling back to /run/results"
RESULTS_DIR=/run/results
mkdir -p "$RESULTS_DIR"
fi
export RESULTS_DIR
}

Expand Down
19 changes: 15 additions & 4 deletions autorun/lib.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# Shared helpers for autorun test scripts.
# Sourced by autorun0 and by each autorun/tests/*.sh.

# Default config — overridden by /run/sysrescue-config/default.env if present
# (build-rescue-usb.sh writes config/default.env to that location on the FAT32
# partition).
# Load the baked-in tunables. build-rescue-usb.sh writes config/default.env
# onto the FAT32 partition, which SystemRescue mounts under
# /run/sysrescue-config. Anything set there overrides the defaults below.
for _cfg in /run/sysrescue-config/default.env /default.env; do
if [[ -r "$_cfg" ]]; then
# shellcheck disable=SC1090
source "$_cfg"
break
fi
done
unset _cfg

: "${STRESS_DURATION_SEC:=7200}"
: "${MEMTESTER_PCT:=95}"
: "${RESULTS_DIR:=/run/results}"
# Empty => autorun0 writes results to the writable FAT32 partition when one is
# found (survives reboot); set an absolute path to override.
: "${RESULTS_DIR:=}"

section() {
printf '\n=== %s ===\n' "$1"
Expand Down
5 changes: 3 additions & 2 deletions config/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ STRESS_DURATION_SEC=7200
# Percent of MemAvailable to test with memtester (default: 95)
MEMTESTER_PCT=95

# Where on the FAT32 partition to drop results files
RESULTS_DIR=/run/results
# Where to write results files. Leave unset to write to the writable FAT32
# partition (so results survive reboot); set an absolute path to override.
# RESULTS_DIR=/mnt/results
Loading