aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.ibm.com>2018-11-26 19:08:24 +1100
committerStewart Smith <stewart@linux.ibm.com>2019-02-14 10:32:11 +1100
commitcc7945c73469a9258acd0affe579c380915f1f26 (patch)
tree4b7be068954113c3240f1caa3b5c99f6bbec0ad7
parent1a90d5922fcf95304adfb08a5745da94b0841b66 (diff)
downloadskiboot-cc7945c73469a9258acd0affe579c380915f1f26.zip
skiboot-cc7945c73469a9258acd0affe579c380915f1f26.tar.gz
skiboot-cc7945c73469a9258acd0affe579c380915f1f26.tar.bz2
hdata/test: workaround dtc bugs
[ Upstream commit b547df61bdadbacde6ff94099a2f89e4f167c9a8 ] 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>
-rw-r--r--hdata/test/Makefile.check8
-rwxr-xr-xhdata/test/dtdiff_wrap.sh13
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