diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-02-10 13:12:51 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-02-16 15:22:30 +1100 |
commit | 2ca064df7da39ad5009b46e1ddeddabf8ff17a08 (patch) | |
tree | 8e5aadeb08d981517aca19c60f15e5eeb8e41074 /hdata/test | |
parent | 0e386883f797ee6fd7023ba24329cb115014973b (diff) | |
download | skiboot-2ca064df7da39ad5009b46e1ddeddabf8ff17a08.zip skiboot-2ca064df7da39ad5009b46e1ddeddabf8ff17a08.tar.gz skiboot-2ca064df7da39ad5009b46e1ddeddabf8ff17a08.tar.bz2 |
hdata_to_dt: Only output dtb
convert test cases to diff DTS rather than DTB.
This means we also have to build dtc on CentOS 7 to be able to run
the test suite.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
[oohall@gmail.com moved the test cases into seperate patches]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/test')
-rw-r--r-- | hdata/test/Makefile.check | 8 | ||||
-rw-r--r-- | hdata/test/hdata_to_dt.c | 50 | ||||
-rw-r--r-- | hdata/test/stubs.c | 2 |
3 files changed, 21 insertions, 39 deletions
diff --git a/hdata/test/Makefile.check b/hdata/test/Makefile.check index 8318eab..45c0a4e 100644 --- a/hdata/test/Makefile.check +++ b/hdata/test/Makefile.check @@ -20,14 +20,14 @@ hdata/test/hdata_to_dt-check-q: hdata/test/hdata_to_dt $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt -s -q hdata/test/p8-840-spira.spirah hdata/test/p8-840-spira.spiras, $<) hdata/test/hdata_to_dt-check-dt: hdata/test/hdata_to_dt - $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt hdata/test/p81-811.spira hdata/test/p81-811.spira.heap |diff -u hdata/test/p81-811.spira.dt -, $< device-tree) - $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt -s hdata/test/p8-840-spira.spirah hdata/test/p8-840-spira.spiras |diff -u hdata/test/p8-840-spira.dt -, $< device-tree) + $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt hdata/test/p81-811.spira hdata/test/p81-811.spira.heap 2>/dev/null |dtc -I dtb -O dts |diff -u hdata/test/p81-811.spira.dts -, $< device-tree) + $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt -s hdata/test/p8-840-spira.spirah hdata/test/p8-840-spira.spiras 2>/dev/null |dtc -I dtb -O dts |diff -u hdata/test/p8-840-spira.dts -, $< device-tree) hdata/test/hdata_to_dt-gcov-run: hdata/test/hdata_to_dt-check-dt-gcov-run hdata/test/hdata_to_dt-check-dt-gcov-run: hdata/test/hdata_to_dt-gcov - $(call Q, TEST-COVERAGE , ./hdata/test/hdata_to_dt-gcov hdata/test/p81-811.spira hdata/test/p81-811.spira.heap |diff -u hdata/test/p81-811.spira.dt -, $< device-tree) - $(call Q, TEST-COVERAGE , ./hdata/test/hdata_to_dt-gcov -s hdata/test/p8-840-spira.spirah hdata/test/p8-840-spira.spiras |diff -u hdata/test/p8-840-spira.dt -, $< device-tree) + $(call Q, TEST-COVERAGE , ./hdata/test/hdata_to_dt-gcov hdata/test/p81-811.spira hdata/test/p81-811.spira.heap 2>/dev/null |dtc -I dtb -O dts|diff -u hdata/test/p81-811.spira.dts -, $< device-tree) + $(call Q, TEST-COVERAGE , ./hdata/test/hdata_to_dt-gcov -s hdata/test/p8-840-spira.spirah hdata/test/p8-840-spira.spiras 2>/dev/null |dtc -I dtb -O dts|diff -u hdata/test/p8-840-spira.dts -, $< device-tree) hdata/test/stubs.o: hdata/test/stubs.c $(call Q, HOSTCC , $(HOSTCC) $(HOSTCFLAGS) -g -c -o $@ $<, $<) diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c index 113887a..8573319 100644 --- a/hdata/test/hdata_to_dt.c +++ b/hdata/test/hdata_to_dt.c @@ -197,10 +197,9 @@ static void squash_blobs(struct dt_node *root) squash_blobs(n); } -static void dump_hdata_fdt(struct dt_node *root, const char *filename) +static void dump_hdata_fdt(struct dt_node *root) { void *fdt_blob; - FILE *f; fdt_blob = create_dtb(root, false); @@ -209,15 +208,7 @@ static void dump_hdata_fdt(struct dt_node *root, const char *filename) return; } - f = fopen(filename, "wb"); - if (!f) { - fprintf(stderr, "Unable to open '%s' for writing\n", filename); - free(fdt_blob); - return; - } - - fwrite(fdt_blob, fdt_totalsize(fdt_blob), 1, f); - fclose(f); + fwrite(fdt_blob, fdt_totalsize(fdt_blob), 1, stdout); free(fdt_blob); } @@ -225,23 +216,15 @@ static void dump_hdata_fdt(struct dt_node *root, const char *filename) int main(int argc, char *argv[]) { int fd, r, i = 0, opt_count = 0; - bool verbose = false, quiet = false, tree_only = false; - bool new_spira = false, blobs = false; - const char *fdt_filename = NULL; + bool verbose = false, quiet = false, new_spira = false, blobs = false; while (argv[++i]) { - if (strcmp(argv[i], "-f") == 0) { - fdt_filename = argv[++i]; - opt_count += 2; - } else if (strcmp(argv[i], "-v") == 0) { + if (strcmp(argv[i], "-v") == 0) { verbose = true; opt_count++; } else if (strcmp(argv[i], "-q") == 0) { quiet = true; opt_count++; - } else if (strcmp(argv[i], "-t") == 0) { - tree_only = true; - opt_count++; } else if (strcmp(argv[i], "-s") == 0) { new_spira = true; opt_count++; @@ -254,15 +237,17 @@ int main(int argc, char *argv[]) argc -= opt_count; argv += opt_count; if (argc != 3) { - errx(1, "Usage:\n" - " hdata <opts> <spira-dump> <heap-dump>\n" - " hdata <opts> -s <spirah-dump> <spiras-dump>\n" - "Options: \n" - " -v Verbose\n" - " -q Quiet mode\n" - " -t Print the DT nodes only, no properties\n" - " -f <filename> File to write the FDT into\n" - " -b Keep blobs in the output\n"); + errx(1, "Converts HDAT dumps to DTB.\n" + "\n" + "Usage:\n" + " hdata <opts> <spira-dump> <heap-dump>\n" + " hdata <opts> -s <spirah-dump> <spiras-dump>\n" + "Options: \n" + " -v Verbose\n" + " -q Quiet mode\n" + " -b Keep blobs in the output\n" + "\n" + "Pipe to 'dtc -I dtb -O dts' for human readable\n"); } /* Copy in spira dump (assumes little has changed!). */ @@ -334,10 +319,7 @@ int main(int argc, char *argv[]) squash_blobs(dt_root); if (!quiet) - dump_dt(dt_root, 0, !tree_only); - - if (fdt_filename) - dump_hdata_fdt(dt_root, fdt_filename); + dump_hdata_fdt(dt_root); dt_free(dt_root); return 0; diff --git a/hdata/test/stubs.c b/hdata/test/stubs.c index 17f17a8..bea433c 100644 --- a/hdata/test/stubs.c +++ b/hdata/test/stubs.c @@ -38,7 +38,7 @@ void _prlog(int log_level __attribute__((unused)), const char* fmt, ...) va_start(ap, fmt); if (log_level < 7) - vprintf(fmt, ap); + vfprintf(stderr, fmt, ap); va_end(ap); } |