[PATCH v2 03/10] dumptrees: pass outputdir as first argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Instead of outputing files to current directory, allow to specificy an
output directory. This helps with meson build system out-of-tree support.

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 tests/Makefile.tests |  2 +-
 tests/dumptrees.c    | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index 5093aaa..51259f0 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -74,7 +74,7 @@ $(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o
 
 $(TESTS_TREES): $(TESTS_PREFIX)dumptrees
 	@$(VECHO) DUMPTREES
-	cd $(TESTS_PREFIX); ./dumptrees >/dev/null
+	cd $(TESTS_PREFIX); ./dumptrees . >/dev/null
 
 tests_clean:
 	@$(VECHO) CLEAN "(tests)"
diff --git a/tests/dumptrees.c b/tests/dumptrees.c
index b2f5b26..aecb326 100644
--- a/tests/dumptrees.c
+++ b/tests/dumptrees.c
@@ -32,6 +32,16 @@ int main(int argc, char *argv[])
 {
 	int i;
 
+	if (argc != 2) {
+	    fprintf(stderr, "Missing output directory argument\n");
+	    return 1;
+	}
+
+	if (chdir(argv[1]) != 0) {
+	    perror("chdir()");
+	    return 1;
+	}
+
 	for (i = 0; i < NUM_TREES; i++) {
 		void *blob = trees[i].blob;
 		const char *filename = trees[i].filename;
-- 
2.23.0




[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux