diff options
author | Stewart Smith <stewart@linux.ibm.com> | 2018-11-26 19:08:24 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-11-26 19:08:24 +1100 |
commit | b547df61bdadbacde6ff94099a2f89e4f167c9a8 (patch) | |
tree | 3203e020b9e8909326b4638a3e5c4845f24795a3 /hdata/test | |
parent | 751cc33a2cfa0008266c38913f0416c1570ce1c0 (diff) | |
download | skiboot-b547df61bdadbacde6ff94099a2f89e4f167c9a8.zip skiboot-b547df61bdadbacde6ff94099a2f89e4f167c9a8.tar.gz skiboot-b547df61bdadbacde6ff94099a2f89e4f167c9a8.tar.bz2 |
hdata/test: workaround dtc bugs
In dtc v1.4.5 to at least v1.4.7 there have been a few bugs introduced
that change the layout of what's produced in the dts. In order to be
immune from them, we should use the (provided) dtdiff utility, but we
also need to run the dts we're diffing against through a dtb cycle in
order to ensure we get the same format as what the hdat_to_dt to dts
conversion will.
This fixes a bunch of unit test failures on the version of dtc shipped
with recent Linux distros such as Fedora 29.
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hdata/test')
-rw-r--r-- | hdata/test/Makefile.check | 8 | ||||
-rwxr-xr-x | hdata/test/dtdiff_wrap.sh | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/hdata/test/Makefile.check b/hdata/test/Makefile.check index 465d110..35524cc 100644 --- a/hdata/test/Makefile.check +++ b/hdata/test/Makefile.check @@ -21,14 +21,14 @@ hdata/test/hdata_to_dt-check-q: hdata/test/hdata_to_dt $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt -8E -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 -8E 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 -8E -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) + $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt -8E hdata/test/p81-811.spira hdata/test/p81-811.spira.heap 2>/dev/null | hdata/test/dtdiff_wrap.sh hdata/test/p81-811.spira.dts, $< device-tree) + $(call Q, TEST , $(VALGRIND) hdata/test/hdata_to_dt -8E -s hdata/test/p8-840-spira.spirah hdata/test/p8-840-spira.spiras 2>/dev/null | hdata/test/dtdiff_wrap.sh 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 -8E 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 -8E -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) + $(call Q, TEST-COVERAGE , ./hdata/test/hdata_to_dt-gcov -8E hdata/test/p81-811.spira hdata/test/p81-811.spira.heap 2>/dev/null | hdata/test/dtdiff_wrap.sh hdata/test/p81-811.spira.dts, $< device-tree) + $(call Q, TEST-COVERAGE , ./hdata/test/hdata_to_dt-gcov -8E -s hdata/test/p8-840-spira.spirah hdata/test/p8-840-spira.spiras 2>/dev/null | hdata/test/dtdiff_wrap.sh 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/dtdiff_wrap.sh b/hdata/test/dtdiff_wrap.sh new file mode 100755 index 0000000..75c18ba --- /dev/null +++ b/hdata/test/dtdiff_wrap.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Takes /dev/stdin as dtb, saves to file, does dtdiff +# Also runs parameter through a dts->dtb->dts conversion +# in order to work around dtc bugs. + +T=$(mktemp) +cp /dev/stdin $T.dtb +dtc -I dts -O dtb $1 > $T.orig.dtb +dtdiff $T.orig.dtb $T.dtb +R=$? +if [ $R == 0 ]; then rm -f $T.dtb; fi +exit $R |