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 | |
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>
-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 | ||||
-rw-r--r-- | opal-ci/Dockerfile-centos6 | 2 | ||||
-rw-r--r-- | opal-ci/Dockerfile-centos7 | 5 | ||||
-rw-r--r-- | opal-ci/Dockerfile-fedora-rawhide | 2 | ||||
-rw-r--r-- | opal-ci/Dockerfile-fedora24 | 2 | ||||
-rw-r--r-- | opal-ci/Dockerfile-fedora25 | 2 | ||||
-rw-r--r-- | opal-ci/Dockerfile-ubuntu-12.04 | 2 | ||||
-rw-r--r-- | opal-ci/Dockerfile-ubuntu-16.04 | 2 | ||||
-rw-r--r-- | opal-ci/Dockerfile-ubuntu-latest | 2 | ||||
-rw-r--r-- | test/dt_common.c | 4 |
12 files changed, 35 insertions, 48 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); } diff --git a/opal-ci/Dockerfile-centos6 b/opal-ci/Dockerfile-centos6 index 6fa069c..162b32b 100644 --- a/opal-ci/Dockerfile-centos6 +++ b/opal-ci/Dockerfile-centos6 @@ -1,6 +1,6 @@ FROM centos:6 RUN yum -y update && yum clean all -RUN yum -y install wget curl xterm gcc git xz ccache +RUN yum -y install wget curl xterm gcc git xz ccache dtc RUN wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.8.0/x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz RUN mkdir /opt/cross RUN tar -C /opt/cross -xf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz diff --git a/opal-ci/Dockerfile-centos7 b/opal-ci/Dockerfile-centos7 index 1f4d829..1708a74 100644 --- a/opal-ci/Dockerfile-centos7 +++ b/opal-ci/Dockerfile-centos7 @@ -1,6 +1,6 @@ FROM centos:7 RUN yum -y update && yum clean all -RUN yum -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache +RUN yum -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache dtc RUN wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.8.0/x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz RUN mkdir /opt/cross RUN tar -C /opt/cross -xf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz @@ -8,6 +8,9 @@ RUN curl -O http://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v RUN yum install -y systemsim-p8-1.0-2.el7.x86_64.rpm RUN curl -O http://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.0-0/systemsim-p9-1.0-0.el7.x86_64.rpm RUN yum install -y systemsim-p9-1.0-0.el7.x86_64.rpm +RUN yum install -y flex bison +RUN curl -L https://github.com/dgibson/dtc/archive/v1.4.2.tar.gz|tar xfz - +RUN (cd dtc-1.4.2; make PREFIX=/usr/local install) COPY . /build/ WORKDIR /build ENTRYPOINT ./opal-ci/build-centos7.sh diff --git a/opal-ci/Dockerfile-fedora-rawhide b/opal-ci/Dockerfile-fedora-rawhide index 2fe4e09..443e409 100644 --- a/opal-ci/Dockerfile-fedora-rawhide +++ b/opal-ci/Dockerfile-fedora-rawhide @@ -1,5 +1,5 @@ FROM fedora:rawhide -RUN dnf -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache +RUN dnf -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache dtc RUN dnf -y install gcc-powerpc64-linux-gnu RUN dnf -y install http://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.0-0/systemsim-p9-1.0-0.f22.x86_64.rpm COPY . /build/ diff --git a/opal-ci/Dockerfile-fedora24 b/opal-ci/Dockerfile-fedora24 index 8110a2d..a120640 100644 --- a/opal-ci/Dockerfile-fedora24 +++ b/opal-ci/Dockerfile-fedora24 @@ -1,5 +1,5 @@ FROM fedora:24 -RUN dnf -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache +RUN dnf -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache dtc RUN dnf -y install gcc-powerpc64-linux-gnu RUN dnf -y install http://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.0-0/systemsim-p9-1.0-0.f22.x86_64.rpm COPY . /build/ diff --git a/opal-ci/Dockerfile-fedora25 b/opal-ci/Dockerfile-fedora25 index eabb6e7..dcc683f 100644 --- a/opal-ci/Dockerfile-fedora25 +++ b/opal-ci/Dockerfile-fedora25 @@ -1,5 +1,5 @@ FROM fedora:25 -RUN dnf -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache +RUN dnf -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache dtc RUN dnf -y install gcc-powerpc64-linux-gnu RUN dnf -y install http://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.0-0/systemsim-p9-1.0-0.f22.x86_64.rpm COPY . /build/ diff --git a/opal-ci/Dockerfile-ubuntu-12.04 b/opal-ci/Dockerfile-ubuntu-12.04 index ee64e92..f38c482 100644 --- a/opal-ci/Dockerfile-ubuntu-12.04 +++ b/opal-ci/Dockerfile-ubuntu-12.04 @@ -3,7 +3,7 @@ RUN sudo apt-get update -qq RUN sudo apt-get install -y software-properties-common RUN sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test RUN sudo apt-get update -qq -RUN sudo apt-get install -y gcc-4.8 libstdc++6 valgrind expect xterm ccache expect +RUN sudo apt-get install -y gcc-4.8 libstdc++6 valgrind expect xterm ccache expect device-tree-compiler RUN sudo apt-get install -y gcc-arm-linux-gnueabi gcc-powerpc64le-linux-gnu gcc RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50 RUN sudo apt-get install -y wget curl diff --git a/opal-ci/Dockerfile-ubuntu-16.04 b/opal-ci/Dockerfile-ubuntu-16.04 index 03cd5c5..11bd1ce 100644 --- a/opal-ci/Dockerfile-ubuntu-16.04 +++ b/opal-ci/Dockerfile-ubuntu-16.04 @@ -1,7 +1,7 @@ FROM ubuntu:16.04 RUN apt-get update -qq RUN apt-get install -y gcc-powerpc64le-linux-gnu gcc ccache expect -RUN apt-get install -y wget curl xterm +RUN apt-get install -y wget curl xterm device-tree-compiler RUN apt-get install -y gcc-arm-linux-gnueabi RUN curl -O ftp://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v1.0-2/systemsim-p8_1.0-2_amd64.deb RUN dpkg -i systemsim-p8_1.0-2_amd64.deb diff --git a/opal-ci/Dockerfile-ubuntu-latest b/opal-ci/Dockerfile-ubuntu-latest index dc9a57f..2b9b038 100644 --- a/opal-ci/Dockerfile-ubuntu-latest +++ b/opal-ci/Dockerfile-ubuntu-latest @@ -1,7 +1,7 @@ FROM ubuntu:latest RUN apt-get update -qq RUN apt-get install -y gcc-powerpc64le-linux-gnu gcc ccache expect -RUN apt-get install -y wget xterm curl +RUN apt-get install -y wget xterm curl device-tree-compiler RUN apt-get install -y gcc-arm-linux-gnueabi RUN curl -O ftp://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v1.0-2/systemsim-p8_1.0-2_amd64.deb RUN dpkg -i systemsim-p8_1.0-2_amd64.deb diff --git a/test/dt_common.c b/test/dt_common.c index 7622081..2da1d72 100644 --- a/test/dt_common.c +++ b/test/dt_common.c @@ -47,7 +47,9 @@ static void dump_val(unsigned indent, const void *prop, size_t size) } } -static void dump_dt(const struct dt_node *root, unsigned indent, bool show_props) +void dump_dt(const struct dt_node *root, unsigned indent, bool show_props); + +void dump_dt(const struct dt_node *root, unsigned indent, bool show_props) { const struct dt_node *i; const struct dt_property *p; |