summaryrefslogtreecommitdiff
path: root/tests/dumptrees.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-10-09 14:20:18 +0400
committerDavid Gibson <david@gibson.dropbear.id.au>2019-10-14 16:20:32 +1100
commit4c3c4ccb9916411aaa682cb60acfbfd7d6232a33 (patch)
treef7c1e20e9703026a2bedeb7802d577ee8d20d7e0 /tests/dumptrees.c
parentaa522da9fff610e9fdad62f5d191e9cbd4ff0fc5 (diff)
downloaddevice-tree-compiler-4c3c4ccb9916411aaa682cb60acfbfd7d6232a33.tar.gz
dumptrees: pass outputdir as first argument
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@redhat.com> Message-Id: <20191009102025.10179-4-marcandre.lureau@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/dumptrees.c')
-rw-r--r--tests/dumptrees.c10
1 files changed, 10 insertions, 0 deletions
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;