Skip to content

Commit

Permalink
[nix] use 'nix build --keep-failed' for vcs sim profile flow
Browse files Browse the repository at this point in the history
  • Loading branch information
FanShupei committed Dec 12, 2024
1 parent 962946c commit 17b45e3
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions nix/t1/run/run-vcs-emu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ stdenvNoCC.mkDerivation (rec {

passthru = {
caseName = testCase.pname;

# to open 'profileReport.html' in firefox,
# set 'security.fileuri.strict_origin_policy = false' in 'about:config'
profile = writeShellScriptBin "runSimProfile" ''
${emuDriver} \
${lib.escapeShellArgs emuDriverArgs} \
-simprofile time \
2> ${testCase.pname}-rtl-event.jsonl
'';
};

emuDriver = "${emulator}/bin/${emulator.mainProgram}";
Expand All @@ -55,12 +46,6 @@ stdenvNoCC.mkDerivation (rec {
];

buildCommand = ''
${lib.optionalString emulator.enableProfile ''
echo "ERROR: 'enableProfile = true' is inherently nondetermistic"
echo " use 'nix run <...>.profile --impure' instead"
exit 1
''}
mkdir -p "$out"
emuDriverArgs="${lib.escapeShellArgs emuDriverArgs}"
Expand All @@ -82,6 +67,13 @@ stdenvNoCC.mkDerivation (rec {
echo "[nix] VCS run done"
${lib.optionalString emulator.enableProfile ''
# we do not want to cache profile results, it's nondetermistic intentionally
echo "ERROR: 'enableProfile = true' fails intentionally"
echo " use 'nix run <...> --impure --keep-failed' to see results"
exit 1
''}
if [ ! -r "$rtlEventOutPath" ]; then
echo -e "[nix] \033[0;31mInternal Error\033[0m: no $rtlEventOutPath found in output"
exit 1
Expand Down Expand Up @@ -111,6 +103,7 @@ stdenvNoCC.mkDerivation (rec {
printf "$?" > $out/offline-check-status
if [ "$(cat $out/offline-check-status)" != "0" ]; then
echo "[nix] Offline check FAIL"
exit 1
else
echo "[nix] Offline check PASS"
fi
Expand Down

0 comments on commit 17b45e3

Please sign in to comment.