diff --git a/tests/builder.nix b/tests/builder.nix index 441a131391..7016042aaa 100644 --- a/tests/builder.nix +++ b/tests/builder.nix @@ -6,12 +6,7 @@ , isFp , vLen - # ip-emu here is used for running the simulation to get event log for the specific test case. -, ip-emu - # t1-script contains many decent default for running the emulator, I don't want to replicate those simulation argument here. -, t1-script -, runCommand -, elaborateConfigJson +, makeEmuResult }: # args from makeBuilder @@ -68,16 +63,8 @@ let dontFixup = true; - passthru.emu-result = runCommand "get-event-log" { } '' - ${t1-script}/bin/t1-helper \ - "ipemu" \ - --emulator-path ${ip-emu}/bin/emulator \ - --config ${elaborateConfigJson} \ - --case ${caseDrv}/bin/${pname}.elf \ - --no-console-logging \ - --no-file-logging \ - --out-dir $out - ''; + passthru.emu-result = makeEmuResult caseDrv; + } // overrides); in caseDrv diff --git a/tests/default.nix b/tests/default.nix index 795b14b877..5a8f3ee6e0 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -20,6 +20,8 @@ let inherit ip-emu; + makeEmuResult = casesSelf.callPackage ./make-emu-result.nix { }; + makeBuilder = casesSelf.callPackage ./builder.nix { }; findAndBuild = dir: build: diff --git a/tests/make-emu-result.nix b/tests/make-emu-result.nix new file mode 100644 index 0000000000..f2f34f0b76 --- /dev/null +++ b/tests/make-emu-result.nix @@ -0,0 +1,20 @@ +# CallPackage args +{ runCommand +, t1-script +, ip-emu +, elaborateConfigJson +}: + +# makeEmuResult arg +testCase: + +runCommand "get-emu-result" { } '' + ${t1-script}/bin/t1-helper \ + "ipemu" \ + --emulator-path ${ip-emu}/bin/emulator \ + --config ${elaborateConfigJson} \ + --case ${testCase}/bin/${testCase.pname}.elf \ + --no-console-logging \ + --no-file-logging \ + --out-dir $out +'' diff --git a/tests/rvv_bench/default.nix b/tests/rvv_bench/default.nix index e5376b838c..3d4b867754 100644 --- a/tests/rvv_bench/default.nix +++ b/tests/rvv_bench/default.nix @@ -3,30 +3,37 @@ , makeBuilder , findAndBuild , t1main +, makeEmuResult }: let include = ./_include; builder = makeBuilder { casePrefix = "rvv_bench"; }; build = { caseName, sourcePath }: - builder { - inherit caseName; + let + drv = builder + { + inherit caseName; - src = sourcePath; + src = sourcePath; - isFp = lib.pathExists (lib.path.append sourcePath "isFp"); + isFp = lib.pathExists (lib.path.append sourcePath "isFp"); - buildPhase = '' - runHook preBuild + buildPhase = '' + runHook preBuild - $CC -E -DINC=$PWD/${caseName}.S -E ${include}/template.S -o functions.S - $CC -I${include} ${caseName}.c -T${linkerScript} ${t1main} functions.S -o $pname.elf + $CC -E -DINC=$PWD/${caseName}.S -E ${include}/template.S -o functions.S + $CC -I${include} ${caseName}.c -T${linkerScript} ${t1main} functions.S -o $pname.elf - runHook postBuild - ''; + runHook postBuild + ''; - meta.description = "test case '${caseName}', written in C intrinsic"; - }; + meta.description = "test case '${caseName}', written in C intrinsic"; + + passthru.emu-result = makeEmuResult drv; + }; + in + drv; in - findAndBuild ./. build +findAndBuild ./. build