From 43b1790f3407b3c6c5394f1274e503b4eb47d851 Mon Sep 17 00:00:00 2001 From: Avimitin Date: Sat, 3 Feb 2024 16:42:08 +0800 Subject: [PATCH] [tests/uarttest] add postUnpack phase to let gcc aware of header paths Signed-off-by: Avimitin --- nix/t1/testcases/make-intrinsic-case.nix | 4 ++++ tests/intrinsic/uarttest/default.nix | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nix/t1/testcases/make-intrinsic-case.nix b/nix/t1/testcases/make-intrinsic-case.nix index 34a28fa6e9..7b7b2917fd 100644 --- a/nix/t1/testcases/make-intrinsic-case.nix +++ b/nix/t1/testcases/make-intrinsic-case.nix @@ -6,6 +6,8 @@ stdenv.mkDerivation (rec { name = "${caseName}-intrinsic"; unpackPhase = '' + runHook preUnpack + if [ -z "''${srcs:-}" ]; then if [ -z "''${src:-}" ]; then echo 'variable $src or $srcs should point to the source' @@ -13,6 +15,8 @@ stdenv.mkDerivation (rec { fi srcs="$src" fi + + runHook postUnpack ''; NIX_CFLAGS_COMPILE = [ diff --git a/tests/intrinsic/uarttest/default.nix b/tests/intrinsic/uarttest/default.nix index 55131299d5..df62ac6df6 100644 --- a/tests/intrinsic/uarttest/default.nix +++ b/tests/intrinsic/uarttest/default.nix @@ -1,9 +1,19 @@ { testcase-env }: testcase-env.mkIntrinsicCase { caseName = "uarttest"; + srcs = [ ./uarttest.c - ./uart.h ../main.S ]; -} \ No newline at end of file + + postUnpack = '' + mkdir -p inc + cp ${./uart.h} ./inc/uart.h + ''; + + preBuild = '' + NIX_CFLAGS_COMPILE="-Iinc $NIX_CFLAGS_COMPILE" + ''; +} +