From 805d53e552d2cec82b86bb489225c8caaad1496b Mon Sep 17 00:00:00 2001 From: Avimitin Date: Mon, 9 Sep 2024 11:23:17 +0800 Subject: [PATCH] [nix] add post install for offline This could help fixing the naming issue when distribute to downstream nix script. Signed-off-by: Avimitin --- difftest/default.nix | 5 +++++ nix/t1/run/run-vcs-emu.nix | 4 ++-- nix/t1/run/run-verilator-emu.nix | 4 ++-- script/emu/src/Main.scala | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/difftest/default.nix b/difftest/default.nix index 528f1a06a..acdff20d2 100644 --- a/difftest/default.nix +++ b/difftest/default.nix @@ -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; diff --git a/nix/t1/run/run-vcs-emu.nix b/nix/t1/run/run-vcs-emu.nix index d1de508b7..8f5e5c039 100644 --- a/nix/t1/run/run-vcs-emu.nix +++ b/nix/t1/run/run-vcs-emu.nix @@ -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 diff --git a/nix/t1/run/run-verilator-emu.nix b/nix/t1/run/run-verilator-emu.nix index c008c39af..69048d433 100644 --- a/nix/t1/run/run-verilator-emu.nix +++ b/nix/t1/run/run-verilator-emu.nix @@ -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 diff --git a/script/emu/src/Main.scala b/script/emu/src/Main.scala index 3caa63a36..3a7457300 100644 --- a/script/emu/src/Main.scala +++ b/script/emu/src/Main.scala @@ -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