Skip to content

Commit c072edc

Browse files
committed
Cleaned up nix flake a little
Removed tests-runner app because people can just run the script directly in the developer environment.
1 parent c6ff5f3 commit c072edc

File tree

3 files changed

+29
-31
lines changed

3 files changed

+29
-31
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Run Lints
6464
run: |
6565
nix run .#lint-all -L
66-
nix build .#checks.x86_64-linux.sonata-simulator-lint -L
66+
nix build .#sonata-simulator-lint -L
6767
6868
- name: Build Documentation
6969
run: |

flake.nix

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
meta.mainProgram = pname;
130130
};
131131

132-
sonata-sim-boot-stub = pkgs.stdenv.mkDerivation rec {
132+
sonata-sim-boot-stub = pkgs.stdenv.mkDerivation {
133133
inherit version;
134134
pname = "sonata-sim-boot-stub";
135135
src = sw/cheri/sim_boot_stub/.;
@@ -190,43 +190,31 @@
190190
};
191191
};
192192

193-
tests-runner = pkgs.writeShellApplication {
194-
name = "tests-runner";
195-
runtimeInputs = with pkgs; [
196-
openocd
197-
(python3.withPackages (pyPkg: with pyPkg; [pyserial]))
198-
];
199-
checkPhase = "";
193+
tests-fpga = pkgs.writeShellApplication {
194+
name = "tests-fpga";
195+
runtimeInputs = [pythonEnv];
200196
text = ''
201-
python ./util/test_runner.py $@
197+
set +u
198+
if [ -z "$1" ]; then
199+
echo "Please provide the tty device location (e.g. /dev/ttyUSB2)" \
200+
"as the first argument."
201+
exit 2
202+
fi
203+
${./util/test_runner.py} -t 30 fpga "$1" \
204+
--elf-file ${sonata-system-software}/bin/test_runner \
205+
--tcl-file ${./util/sonata-openocd-cfg.tcl}
202206
'';
203207
};
204208

205-
tests-fpga-runner = pkgs.writers.writeBashBin "tests-fpga-runner" ''
206-
set -e
207-
if [ -z "$1" ]; then
208-
echo "Please provide the tty device location (e.g. /dev/ttyUSB2)" \
209-
"as the first argument."
210-
exit 2
211-
fi
212-
${getExe tests-runner} -t 30 fpga $1 \
213-
--elf-file ${sonata-system-software}/bin/test_runner \
214-
--tcl-file ${./util/sonata-openocd-cfg.tcl}
215-
#$\{getExe tests-runner} -t 30 fpga $1 --uf2-file $\{cheriot-rtos-test-suite}/share/test-suite.uf2
216-
'';
217-
218209
tests-simulator = pkgs.stdenvNoCC.mkDerivation {
219210
name = "tests-simulator";
220211
src = ./.;
221212
dontBuild = true;
222213
doCheck = true;
223-
buildInputs = [sonata-simulator];
214+
buildInputs = [sonata-simulator pythonEnv];
224215
checkPhase = ''
225-
${getExe tests-runner} -t 30 sim \
216+
python ${./util/test_runner.py} -t 30 sim \
226217
--elf-file ${sonata-system-software}/bin/test_runner
227-
#$\{getExe tests-runner} -t 600 sim \
228-
# --sim-boot-stub $\{sonata-sim-boot-stub.out}/share/sim_boot_stub \
229-
# --elf-file $\{cheriot-rtos-test-suite}/share/test-suite
230218
'';
231219
installPhase = "mkdir $out";
232220
};
@@ -251,15 +239,24 @@
251239
])
252240
++ (with sonata-simulator; buildInputs ++ nativeBuildInputs);
253241
};
254-
packages = {inherit sonata-simulator sonata-sim-boot-stub sonata-documentation sonata-system-software cheriot-rtos-test-suite;};
255-
checks = {inherit sonata-simulator-lint tests-simulator;};
242+
packages = {
243+
inherit
244+
sonata-simulator
245+
sonata-simulator-lint
246+
sonata-sim-boot-stub
247+
sonata-documentation
248+
sonata-system-software
249+
cheriot-rtos-test-suite
250+
;
251+
};
252+
checks = {inherit tests-simulator;};
256253
apps = builtins.listToAttrs (map (program: {
257254
inherit (program) name;
258255
value = {
259256
type = "app";
260257
program = getExe program;
261258
};
262-
}) [lint-all lint-markdown lint-python tests-runner tests-fpga-runner]);
259+
}) [lint-all lint-markdown lint-python tests-fpga]);
263260
};
264261
in
265262
flake-utils.lib.eachDefaultSystem system_outputs;

util/test_runner.py

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python
12
# Copyright lowRISC Contributors.
23
# SPDX-License-Identifier: Apache-2.0
34

0 commit comments

Comments
 (0)