Skip to content

Commit

Permalink
[nix] add post install for offline
Browse files Browse the repository at this point in the history
This could help fixing the naming issue when distribute to downstream
nix script.

Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin authored and Clo91eaf committed Sep 9, 2024
1 parent 361930e commit 76d9fde
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions difftest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ rustPlatform.buildRustPackage {
lockFile = ./Cargo.lock;
};

postInstall = lib.optionalString (lib.hasPrefix "offline" moduleType) ''
exe=$(find $out/bin -type f -name 'offline_*')
ln -s "$exe" $out/bin/offline
'';

passthru = {
dpiLibPath = "/lib/libdpi_${moduleType}.a";
inherit enableTrace;
Expand Down
4 changes: 2 additions & 2 deletions nix/t1/run/run-vcs-emu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ stdenvNoCC.mkDerivation (finalAttr: {
"ERROR"
)
offlineCheckArgs="''${offlineCheckArgsArray[@]}"
echo -e "[nix] running offline check: \033[0;34m${emulator}/bin/offline_t1 $offlineCheckArgs\033[0m"
"${offline-checker}/bin/offline_t1" $offlineCheckArgs &> >(tee $out/offline-check-journal)
echo -e "[nix] running offline check: \033[0;34m${emulator}/bin/offline $offlineCheckArgs\033[0m"
"${offline-checker}/bin/offline" $offlineCheckArgs &> >(tee $out/offline-check-journal)
printf "$?" > $out/offline-check-status
if [ "$(cat $out/offline-check-status)" != "0" ]; then
Expand Down
4 changes: 2 additions & 2 deletions nix/t1/run/run-verilator-emu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ stdenvNoCC.mkDerivation (finalAttr: {
"info"
)
offlineCheckArgs="''${offlineCheckArgsArray[@]}"
echo -e "[nix] running offline check: \033[0;34m${offline-checker}/bin/offline_t1 $offlineCheckArgs\033[0m"
"${offline-checker}/bin/offline_t1" $offlineCheckArgs &> $out/offline-check-journal
echo -e "[nix] running offline check: \033[0;34m${offline-checker}/bin/offline $offlineCheckArgs\033[0m"
"${offline-checker}/bin/offline" $offlineCheckArgs &> $out/offline-check-journal
printf "$?" > $out/offline-check-status
if [ "$(cat $out/offline-check-status)" != "0" ]; then
Expand Down
2 changes: 1 addition & 1 deletion script/emu/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ object Main:

val offlineChecker = os.Path(
resolveNixPath(s".#t1.${finalConfig}.ip.offline-checker")
) / "bin" / (if finalConfig == "t1rocket" then "offline_t1rocket" else "offline_t1")
) / "bin" / "offline"

val elfFile =
if caseAttr.isDefined then resolveTestElfPath(finalConfig, caseAttr.get).toString
Expand Down

0 comments on commit 76d9fde

Please sign in to comment.