Fix script generation in Makefile

This would fail if the target folder didnt exist already.
This commit is contained in:
Andre Richter 2020-01-01 22:34:45 +01:00
parent 1b164e50a1
commit 447b0aaa4e
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E
2 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,6 @@
## SPDX-License-Identifier: MIT OR Apache-2.0
##
## Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
## Copyright (c) 2018-2020 Andre Richter <andre.o.richter@gmail.com>
# Default to the RPi3
ifndef BSP
@ -98,7 +98,7 @@ qemu: all
$(DOCKER_EXEC_QEMU) $(QEMU_RELEASE_ARGS) \
-kernel $(OUTPUT)
define kernel_test_runner
define KERNEL_TEST_RUNNER
#!/usr/bin/env bash
$(OBJCOPY_CMD) $$1 $$1.img
@ -107,9 +107,10 @@ define kernel_test_runner
ruby tests/runner.rb $(DOCKER_EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY
endef
export KERNEL_TEST_RUNNER
test: $(SOURCES)
@mkdir -p target
$(file > target/kernel_test_runner.sh,$(kernel_test_runner))
@echo "$$KERNEL_TEST_RUNNER" > target/kernel_test_runner.sh
@chmod +x target/kernel_test_runner.sh
RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(XTEST_CMD) $(TEST_ARG)
endif

View File

@ -341,7 +341,7 @@ The file `kernel_test_runner.sh` does not exist by default. We generate it on de
`make test` target:
```Makefile
define kernel_test_runner
define KERNEL_TEST_RUNNER
#!/usr/bin/env bash
$(OBJCOPY_CMD) $$1 $$1.img
@ -350,9 +350,10 @@ define kernel_test_runner
ruby tests/runner.rb $(DOCKER_EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY
endef
export KERNEL_TEST_RUNNER
test: $(SOURCES)
@mkdir -p target
$(file > target/kernel_test_runner.sh,$(kernel_test_runner))
@echo "$$KERNEL_TEST_RUNNER" > target/kernel_test_runner.sh
@chmod +x target/kernel_test_runner.sh
RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(XTEST_CMD) $(TEST_ARG)
endif