From 29257546639372c5df70f96b49eb928d7613aa5d Mon Sep 17 00:00:00 2001 From: Avimitin Date: Mon, 19 Aug 2024 23:40:35 +0800 Subject: [PATCH] [nix] expose 'with-offline-trace-log' attr for debugging Signed-off-by: Avimitin --- difftest/run-emulator.nix | 137 ++++++++++++----------- nix/t1/run-vcs-emulation.nix | 150 ++++++++++++++------------ t1rocketemu/nix/run-emulator.nix | 138 +++++++++++++----------- t1rocketemu/nix/run-vcs-emulation.nix | 127 ++++++++++++---------- 4 files changed, 303 insertions(+), 249 deletions(-) diff --git a/difftest/run-emulator.nix b/difftest/run-emulator.nix index baee3ec7a2..5ffcb9ac59 100644 --- a/difftest/run-emulator.nix +++ b/difftest/run-emulator.nix @@ -1,79 +1,92 @@ -{ lib, runCommand, zstd, jq }: +{ lib, zstd, jq, stdenvNoCC }: emulator: testCase: -runCommand "run-${emulator.name}-for-${testCase.pname}" -{ +stdenvNoCC.mkDerivation (finalAttr: { name = "${testCase.pname}-emu-result" + (lib.optionalString emulator.enable-trace "-trace"); nativeBuildInputs = [ zstd jq ]; -} '' - mkdir -p "$out" - emuDriverArgsArray=( - "--elf-file" - "${testCase}/bin/${testCase.pname}.elf" - "--log-file" - "$out/emu.log" - "--log-level" - "ERROR" - ${lib.optionalString emulator.enable-trace "--wave-path"} - ${lib.optionalString emulator.enable-trace "$out/wave.fst"} - ) - emuDriverArgs="''${emuDriverArgsArray[@]}" - emuDriver="${emulator}/bin/online_drive" + offlineLogLevel = "ERROR"; + passthru.with-offline-trace-log = finalAttr.finalPackage.overrideAttrs { offlineLogLevel = "TRACE"; }; - rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" + buildCommand = '' + mkdir -p "$out" - echo "[nix] Running test case ${testCase.pname} with args $emuDriverArgs" + emuDriverArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + "--log-file" + "$out/emu.log" + "--log-level" + "ERROR" + ${lib.optionalString emulator.enable-trace "--wave-path"} + ${lib.optionalString emulator.enable-trace "$out/wave.fst"} + ) + emuDriverArgs="''${emuDriverArgsArray[@]}" + emuDriver="${emulator}/bin/online_drive" - export RUST_BACKTRACE=full - if ! "$emuDriver" $emuDriverArgs 2> "$rtlEventOutPath"; then - echo -e "\033[0;31m[nix]\033[0m: online driver run failed" - cat $rtlEventOutPath - echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" - exit 1 - fi + rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" - echo "[nix] online driver run done" + echo -e "[nix] Running test case ${testCase.pname} with args \033[0;34m$emuDriverArgs\033[0m" - if [ ! -r "$rtlEventOutPath" ]; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" - exit 1 - fi + export RUST_BACKTRACE=full + if ! "$emuDriver" $emuDriverArgs 2> "$rtlEventOutPath"; then + echo -e "\033[0;31m[nix]\033[0m: online driver run failed" + cat $rtlEventOutPath + echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" + exit 1 + fi - if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" - echo "--------------------------------------------" - cat $rtlEventOutPath - echo "--------------------------------------------" - exit 1 - fi + echo "[nix] online driver run done" - set +e - "${emulator}/bin/offline" \ - --elf-file ${testCase}/bin/${testCase.pname}.elf \ - --log-file $rtlEventOutPath \ - --log-level ERROR &> $out/offline-check-journal - printf "$?" > $out/offline-check-status - if [ "$(cat $out/offline-check-status)" != "0" ]; then - echo "[nix] Offline check FAIL" - else - echo "[nix] Offline check PASS" - fi - set -e + if [ ! -r "$rtlEventOutPath" ]; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" + exit 1 + fi - echo "[nix] compressing event log" - zstd $rtlEventOutPath -o $rtlEventOutPath.zstd - rm $rtlEventOutPath + if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" + echo "--------------------------------------------" + cat $rtlEventOutPath + echo "--------------------------------------------" + exit 1 + fi - if [ -r perf.txt ]; then - mv perf.txt $out/ - fi + set +e + offlineCheckArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + "--log-file" + "$rtlEventOutPath" + "--log-level" + "$offlineLogLevel" + ) + offlineCheckArgs="''${offlineCheckArgsArray[@]}" + echo -e "[nix] running offline check: \033[0;34m${emulator}/bin/offline $offlineCheckArgs\033[0m" + "${emulator}/bin/offline" $offlineCheckArgs &> $TMPDIR/offline-check-journal + tail -n1000 $TMPDIR/offline-check-journal > $out/offline-check-journal - ${lib.optionalString emulator.enable-trace '' - if [ ! -r "$out/wave.fst" ]; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: waveform not found in output" - exit 1 + printf "$?" > $out/offline-check-status + if [ "$(cat $out/offline-check-status)" != "0" ]; then + echo "[nix] Offline check FAIL" + else + echo "[nix] Offline check PASS" fi - ''} -'' + set -e + + echo "[nix] compressing event log" + zstd $rtlEventOutPath -o $rtlEventOutPath.zstd + rm $rtlEventOutPath + + if [ -r perf.txt ]; then + mv perf.txt $out/ + fi + + ${lib.optionalString emulator.enable-trace '' + if [ ! -r "$out/wave.fst" ]; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: waveform not found in output" + exit 1 + fi + ''} + ''; +}) diff --git a/nix/t1/run-vcs-emulation.nix b/nix/t1/run-vcs-emulation.nix index 8c4f9f3c7e..ffe43af64d 100644 --- a/nix/t1/run-vcs-emulation.nix +++ b/nix/t1/run-vcs-emulation.nix @@ -1,75 +1,89 @@ # FIXME: we should have offline check for VCS, importing offline check from verilator-emu is weird -{ lib, runCommand, zstd, jq, verilator-emu }: +{ lib, stdenvNoCC, zstd, jq, verilator-emu }: emulator: testCase: -runCommand "run-${emulator.name}-for-${testCase.pname}" -{ +stdenvNoCC.mkDerivation (finalAttr: { + name = "${testCase.pname}-vcs-result" + (lib.optionalString emulator.enable-trace "-trace"); nativeBuildInputs = [ zstd jq ]; __noChroot = true; -} '' - mkdir -p "$out" - - emuDriverArgsArray=( - "--elf-file" - "${testCase}/bin/${testCase.pname}.elf" - ${lib.optionalString emulator.enable-trace "--wave-path"} - ${lib.optionalString emulator.enable-trace "${testCase.pname}.fsdb"} - ) - emuDriverArgs="''${emuDriverArgsArray[@]}" - emuDriver="${emulator}/bin/t1-vcs-simulator" - - rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" - - echo "[nix] Running VCS ${testCase.pname} with args $emuDriverArgs" - - export RUST_BACKTRACE=full - if ! "$emuDriver" $emuDriverArgs >/dev/null 2>"$rtlEventOutPath"; then - echo -e "\033[0;31m[nix]\033[0m: online driver run failed" - cat $rtlEventOutPath - echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" - exit 1 - fi - - echo "[nix] VCS run done" - - if [ ! -r "$rtlEventOutPath" ]; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" - exit 1 - fi - - if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" - echo "--------------------------------------------" - cat $rtlEventOutPath - echo "--------------------------------------------" - exit 1 - fi - - set +e - "${verilator-emu}/bin/offline" \ - --elf-file ${testCase}/bin/${testCase.pname}.elf \ - --log-file $rtlEventOutPath \ - --log-level ERROR &> $out/offline-check-journal - printf "$?" > $out/offline-check-status - if [ "$(cat $out/offline-check-status)" != "0" ]; then - echo "[nix] Offline check FAIL" - else - echo "[nix] Offline check PASS" - fi - set -e - - echo "[nix] compressing event log" - zstd $rtlEventOutPath -o $rtlEventOutPath.zstd - rm $rtlEventOutPath - - if [ -r perf.txt ]; then - mv perf.txt $out/ - fi - - ${lib.optionalString emulator.enable-trace '' - cp -v ${testCase.pname}.fsdb "$out" - cp -vr ${emulator}/lib/t1-vcs-simulator.daidir "$out" - ''} -'' + + offlineLogLevel = "ERROR"; + passthru.with-offline-trace-log = finalAttr.finalPackage.overrideAttrs { offlineLogLevel = "TRACE"; }; + + buildCommand = '' + mkdir -p "$out" + + emuDriverArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + ${lib.optionalString emulator.enable-trace "--wave-path"} + ${lib.optionalString emulator.enable-trace "${testCase.pname}.fsdb"} + ) + emuDriverArgs="''${emuDriverArgsArray[@]}" + emuDriver="${emulator}/bin/t1-vcs-simulator" + + rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" + + echo "[nix] Running VCS ${testCase.pname} with args $emuDriverArgs" + + export RUST_BACKTRACE=full + if ! "$emuDriver" $emuDriverArgs >/dev/null 2>"$rtlEventOutPath"; then + echo -e "\033[0;31m[nix]\033[0m: online driver run failed" + cat $rtlEventOutPath + echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" + exit 1 + fi + + echo "[nix] VCS run done" + + if [ ! -r "$rtlEventOutPath" ]; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" + exit 1 + fi + + if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" + echo "--------------------------------------------" + cat $rtlEventOutPath + echo "--------------------------------------------" + exit 1 + fi + + set +e + offlineCheckArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + "--log-file" + "$rtlEventOutPath" + "--log-level" + "$offlineLogLevel" + ) + offlineCheckArgs="''${offlineCheckArgsArray[@]}" + echo -e "[nix] running offline check: \033[0;34m${emulator}/bin/offline $offlineCheckArgs\033[0m" + "${verilator-emu}/bin/offline" $offlineCheckArgs &> $TMPDIR/offline-check-journal + tail -n1000 $TMPDIR/offline-check-journal > $out/offline-check-journal + + printf "$?" > $out/offline-check-status + if [ "$(cat $out/offline-check-status)" != "0" ]; then + echo "[nix] Offline check FAIL" + else + echo "[nix] Offline check PASS" + fi + set -e + + echo "[nix] compressing event log" + zstd $rtlEventOutPath -o $rtlEventOutPath.zstd + rm $rtlEventOutPath + + if [ -r perf.txt ]; then + mv perf.txt $out/ + fi + + ${lib.optionalString emulator.enable-trace '' + cp -v ${testCase.pname}.fsdb "$out" + cp -vr ${emulator}/lib/t1-vcs-simulator.daidir "$out" + ''} + ''; +}) diff --git a/t1rocketemu/nix/run-emulator.nix b/t1rocketemu/nix/run-emulator.nix index cd2fdfc3ac..3bac91df7a 100644 --- a/t1rocketemu/nix/run-emulator.nix +++ b/t1rocketemu/nix/run-emulator.nix @@ -1,78 +1,92 @@ -{ lib, runCommand, zstd, jq }: +{ lib, stdenvNoCC, zstd, jq }: emulator: testCase: -runCommand ("${emulator.name}-${testCase.pname}-emu-result" + lib.optionalString emulator.enable-trace "-trace") -{ +stdenvNoCC.mkDerivation (finalAttr: { + name = "${emulator.name}-${testCase.pname}-emu-result" + lib.optionalString emulator.enable-trace "-trace"; nativeBuildInputs = [ zstd jq ]; -} '' - mkdir -p "$out" - emuDriverArgsArray=( - "--elf-file" - "${testCase}/bin/${testCase.pname}.elf" - "--log-file" - "$out/emu.log" - "--log-level" - "ERROR" - ${lib.optionalString emulator.enable-trace "--wave-path"} - ${lib.optionalString emulator.enable-trace "$out/wave.fst"} - ) - emuDriverArgs="''${emuDriverArgsArray[@]}" - emuDriver="${emulator}/bin/online_drive" + offlineLogLevel = "ERROR"; + passthru.with-offline-trace-log = finalAttr.finalPackage.overrideAttrs { offlineLogLevel = "TRACE"; }; - rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" + buildCommand = '' + mkdir -p "$out" - echo "[nix] Running test case ${testCase.pname} with args $emuDriverArgs" + emuDriverArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + "--log-file" + "$out/emu.log" + "--log-level" + "ERROR" + ${lib.optionalString emulator.enable-trace "--wave-path"} + ${lib.optionalString emulator.enable-trace "$out/wave.fst"} + ) + emuDriverArgs="''${emuDriverArgsArray[@]}" + emuDriver="${emulator}/bin/online_drive" - export RUST_BACKTRACE=full - if ! "$emuDriver" $emuDriverArgs 2> "$rtlEventOutPath"; then - echo -e "\033[0;31m[nix]\033[0m: online driver run failed" - cat $rtlEventOutPath - echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" - exit 1 - fi + rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" - echo "[nix] t1rocket run done" + echo "[nix] Running test case ${testCase.pname} with args $emuDriverArgs" - if [ ! -r "$rtlEventOutPath" ]; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" - exit 1 - fi + export RUST_BACKTRACE=full + if ! "$emuDriver" $emuDriverArgs 2> "$rtlEventOutPath"; then + echo -e "\033[0;31m[nix]\033[0m: online driver run failed" + cat $rtlEventOutPath + echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" + exit 1 + fi - if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" - echo "--------------------------------------------" - cat $rtlEventOutPath - echo "--------------------------------------------" - exit 1 - fi + echo "[nix] t1rocket run done" - set +e - "${emulator}/bin/offline" \ - --elf-file ${testCase}/bin/${testCase.pname}.elf \ - --log-file $rtlEventOutPath \ - --log-level ERROR &> $out/offline-check-journal - printf "$?" > $out/offline-check-status - if [ "$(cat $out/offline-check-status)" != "0" ]; then - echo "[nix] Offline check FAIL" - else - echo "[nix] Offline check PASS" - fi - set -e + if [ ! -r "$rtlEventOutPath" ]; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" + exit 1 + fi - echo "[nix] compressing event log" - zstd $rtlEventOutPath -o $rtlEventOutPath.zstd - rm $rtlEventOutPath + if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" + echo "--------------------------------------------" + cat $rtlEventOutPath + echo "--------------------------------------------" + exit 1 + fi - if [ -r perf.txt ]; then - mv perf.txt $out/ - fi + set +e + offlineCheckArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + "--log-file" + "$rtlEventOutPath" + "--log-level" + "$offlineLogLevel" + ) + offlineCheckArgs="''${offlineCheckArgsArray[@]}" + echo -e "[nix] running offline check: \033[0;34m${emulator}/bin/offline $offlineCheckArgs\033[0m" + "${emulator}/bin/offline" $offlineCheckArgs &> $TMPDIR/offline-check-journal + tail -n1000 $TMPDIR/offline-check-journal > $out/offline-check-journal - ${lib.optionalString emulator.enable-trace '' - if [ ! -r "$out/wave.fst" ]; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: waveform not found in output" - exit 1 + printf "$?" > $out/offline-check-status + if [ "$(cat $out/offline-check-status)" != "0" ]; then + echo "[nix] Offline check FAIL" + else + echo "[nix] Offline check PASS" fi - ''} -'' + set -e + + echo "[nix] compressing event log" + zstd $rtlEventOutPath -o $rtlEventOutPath.zstd + rm $rtlEventOutPath + + if [ -r perf.txt ]; then + mv perf.txt $out/ + fi + + ${lib.optionalString emulator.enable-trace '' + if [ ! -r "$out/wave.fst" ]; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: waveform not found in output" + exit 1 + fi + ''} + ''; +}) diff --git a/t1rocketemu/nix/run-vcs-emulation.nix b/t1rocketemu/nix/run-vcs-emulation.nix index d4df55cb08..e315234d32 100644 --- a/t1rocketemu/nix/run-vcs-emulation.nix +++ b/t1rocketemu/nix/run-vcs-emulation.nix @@ -1,75 +1,88 @@ # FIXME: this is not a correct design, we should have offline check command in VCS emulator -{ lib, runCommand, zstd, jq, verilator-emu }: +{ lib, stdenvNoCC, zstd, jq, verilator-emu }: emulator: testCase: -runCommand "run-${emulator.name}-for-${testCase.pname}" -{ +stdenvNoCC.mkDerivation (finalAttr: { name = "${testCase.pname}-vcs-result" + (lib.optionalString emulator.enable-trace "-trace"); nativeBuildInputs = [ zstd jq ]; __noChroot = true; -} '' - mkdir -p "$out" - emuDriverArgsArray=( - "--elf-file" - "${testCase}/bin/${testCase.pname}.elf" - ${lib.optionalString emulator.enable-trace "--wave-path"} - ${lib.optionalString emulator.enable-trace "${testCase.pname}.fsdb"} - ) - emuDriverArgs="''${emuDriverArgsArray[@]}" - emuDriver="${emulator}/bin/t1-vcs-simulator" + offlineLogLevel = "ERROR"; + passthru.with-offline-trace-log = finalAttr.finalPackage.overrideAttrs { offlineLogLevel = "TRACE"; }; - rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" + buildCommand = '' + mkdir -p "$out" - echo "[nix] Running VCS ${testCase.pname} with args $emuDriverArgs" + emuDriverArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + ${lib.optionalString emulator.enable-trace "--wave-path"} + ${lib.optionalString emulator.enable-trace "${testCase.pname}.fsdb"} + ) + emuDriverArgs="''${emuDriverArgsArray[@]}" + emuDriver="${emulator}/bin/t1-vcs-simulator" - export RUST_BACKTRACE=full - if ! "$emuDriver" $emuDriverArgs >/dev/null 2>"$rtlEventOutPath"; then - echo -e "\033[0;31m[nix]\033[0m: online driver run failed" - cat $rtlEventOutPath - echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" - exit 1 - fi + rtlEventOutPath="$out/${testCase.pname}-rtl-event.jsonl" - echo "[nix] VCS run done" + echo "[nix] Running VCS ${testCase.pname} with args $emuDriverArgs" - if [ ! -r "$rtlEventOutPath" ]; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" - exit 1 - fi + export RUST_BACKTRACE=full + if ! "$emuDriver" $emuDriverArgs >/dev/null 2>"$rtlEventOutPath"; then + echo -e "\033[0;31m[nix]\033[0m: online driver run failed" + cat $rtlEventOutPath + echo -e "\033[0;31m[nix]\033[0m: Try rerun with '\033[0;34m$emuDriver $emuDriverArgs\033[0m'" + exit 1 + fi - if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then - echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" - echo "--------------------------------------------" - cat $rtlEventOutPath - echo "--------------------------------------------" - exit 1 - fi + echo "[nix] VCS run done" - set +e - "${verilator-emu}/bin/offline" \ - --elf-file ${testCase}/bin/${testCase.pname}.elf \ - --log-file $rtlEventOutPath \ - --log-level ERROR &> $out/offline-check-journal - printf "$?" > $out/offline-check-status - if [ "$(cat $out/offline-check-status)" != "0" ]; then - echo "[nix] Offline check FAIL" - else - echo "[nix] Offline check PASS" - fi - set -e + if [ ! -r "$rtlEventOutPath" ]; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output" + exit 1 + fi - echo "[nix] compressing event log" - zstd $rtlEventOutPath -o $rtlEventOutPath.zstd - rm $rtlEventOutPath + if ! jq --stream -c -e '.[]' "$rtlEventOutPath" >/dev/null 2>&1; then + echo -e "[nix] \033[0;31mInternal Error\033[0m: invalid JSON file $rtlEventOutPath, showing original file:" + echo "--------------------------------------------" + cat $rtlEventOutPath + echo "--------------------------------------------" + exit 1 + fi - if [ -r perf.txt ]; then - mv perf.txt $out/ - fi + set +e + offlineCheckArgsArray=( + "--elf-file" + "${testCase}/bin/${testCase.pname}.elf" + "--log-file" + "$rtlEventOutPath" + "--log-level" + "$offlineLogLevel" + ) + offlineCheckArgs="''${offlineCheckArgsArray[@]}" + echo -e "[nix] running offline check: \033[0;34m${emulator}/bin/offline $offlineCheckArgs\033[0m" + "${verilator-emu}/bin/offline" $offlineCheckArgs &> $TMPDIR/offline-check-journal + tail -n1000 $TMPDIR/offline-check-journal > $out/offline-check-journal - ${lib.optionalString emulator.enable-trace '' - cp -v ${testCase.pname}.fsdb "$out" - cp -vr ${emulator}/lib/t1-vcs-simulator.daidir "$out" - ''} -'' + printf "$?" > $out/offline-check-status + if [ "$(cat $out/offline-check-status)" != "0" ]; then + echo "[nix] Offline check FAIL" + else + echo "[nix] Offline check PASS" + fi + set -e + + echo "[nix] compressing event log" + zstd $rtlEventOutPath -o $rtlEventOutPath.zstd + rm $rtlEventOutPath + + if [ -r perf.txt ]; then + mv perf.txt $out/ + fi + + ${lib.optionalString emulator.enable-trace '' + cp -v ${testCase.pname}.fsdb "$out" + cp -vr ${emulator}/lib/t1-vcs-simulator.daidir "$out" + ''} + ''; +})