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 ## 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 # Default to the RPi3
ifndef BSP ifndef BSP
@ -98,7 +98,7 @@ qemu: all
$(DOCKER_EXEC_QEMU) $(QEMU_RELEASE_ARGS) \ $(DOCKER_EXEC_QEMU) $(QEMU_RELEASE_ARGS) \
-kernel $(OUTPUT) -kernel $(OUTPUT)
define kernel_test_runner define KERNEL_TEST_RUNNER
#!/usr/bin/env bash #!/usr/bin/env bash
$(OBJCOPY_CMD) $$1 $$1.img $(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 ruby tests/runner.rb $(DOCKER_EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY
endef endef
export KERNEL_TEST_RUNNER
test: $(SOURCES) test: $(SOURCES)
@mkdir -p target @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 @chmod +x target/kernel_test_runner.sh
RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(XTEST_CMD) $(TEST_ARG) RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(XTEST_CMD) $(TEST_ARG)
endif 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: `make test` target:
```Makefile ```Makefile
define kernel_test_runner define KERNEL_TEST_RUNNER
#!/usr/bin/env bash #!/usr/bin/env bash
$(OBJCOPY_CMD) $$1 $$1.img $(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 ruby tests/runner.rb $(DOCKER_EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY
endef endef
export KERNEL_TEST_RUNNER
test: $(SOURCES) test: $(SOURCES)
@mkdir -p target @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 @chmod +x target/kernel_test_runner.sh
RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(XTEST_CMD) $(TEST_ARG) RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(XTEST_CMD) $(TEST_ARG)
endif endif