Skip to content

Commit

Permalink
[tests/uarttest] add postUnpack phase to let gcc aware of header paths
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin authored and cyyself committed Feb 24, 2024
1 parent 52adc1a commit dccb18f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions nix/t1/testcases/make-intrinsic-case.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ 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'
exit 1
fi
srcs="$src"
fi
runHook postUnpack
'';

NIX_CFLAGS_COMPILE = [
Expand Down
14 changes: 12 additions & 2 deletions tests/intrinsic/uarttest/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{ testcase-env }:
testcase-env.mkIntrinsicCase {
caseName = "uarttest";

srcs = [
./uarttest.c
./uart.h
../main.S
];
}

postUnpack = ''
mkdir -p inc
cp ${./uart.h} ./inc/uart.h
'';

preBuild = ''
NIX_CFLAGS_COMPILE="-Iinc $NIX_CFLAGS_COMPILE"
'';
}

0 comments on commit dccb18f

Please sign in to comment.