From 518e479dbf5197402d70e3b3f99e9e2b202cdce4 Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Tue, 10 Sep 2013 19:53:07 +0000 Subject: [PATCH] utils/tests: add hwloc-patch/hwloc-diff test This commit was SVN r5805. --- config/hwloc_internal.m4 | 3 +- utils/Makefile.am | 2 + utils/test-hwloc-diffpatch.input1 | 170 ++++++++++++++++++++++++++++++ utils/test-hwloc-diffpatch.input2 | 170 ++++++++++++++++++++++++++++++ utils/test-hwloc-diffpatch.sh.in | 47 +++++++++ 5 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 utils/test-hwloc-diffpatch.input1 create mode 100644 utils/test-hwloc-diffpatch.input2 create mode 100644 utils/test-hwloc-diffpatch.sh.in diff --git a/config/hwloc_internal.m4 b/config/hwloc_internal.m4 index b60f4118..5a868254 100644 --- a/config/hwloc_internal.m4 +++ b/config/hwloc_internal.m4 @@ -412,13 +412,14 @@ int foo(void) { hwloc_config_prefix[utils/test-hwloc-annotate.sh] hwloc_config_prefix[utils/test-hwloc-assembler.sh] hwloc_config_prefix[utils/test-hwloc-calc.sh] + hwloc_config_prefix[utils/test-hwloc-diffpatch.sh] hwloc_config_prefix[utils/test-hwloc-distances.sh] hwloc_config_prefix[utils/test-hwloc-distrib.sh] hwloc_config_prefix[utils/test-hwloc-info.sh] hwloc_config_prefix[utils/test-hwloc-ls.sh] hwloc_config_prefix[utils/test-fake-plugin.sh]) - AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/hwloc-gather-topology ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[tests/wrapper.sh ]hwloc_config_prefix[utils/hwloc-assembler-remote ]hwloc_config_prefix[utils/test-hwloc-annotate.sh ]hwloc_config_prefix[utils/test-hwloc-assembler.sh ]hwloc_config_prefix[utils/test-hwloc-calc.sh ]hwloc_config_prefix[utils/test-hwloc-distances.sh ]hwloc_config_prefix[utils/test-hwloc-distrib.sh ]hwloc_config_prefix[utils/test-hwloc-info.sh ]hwloc_config_prefix[utils/test-hwloc-ls.sh ]hwloc_config_prefix[utils/test-fake-plugin.sh]) + AC_CONFIG_COMMANDS([chmoding-scripts], [chmod +x ]hwloc_config_prefix[tests/linux/test-topology.sh ]hwloc_config_prefix[tests/xml/test-topology.sh ]hwloc_config_prefix[tests/linux/hwloc-gather-topology ]hwloc_config_prefix[tests/linux/gather/test-gather-topology.sh ]hwloc_config_prefix[tests/wrapper.sh ]hwloc_config_prefix[utils/hwloc-assembler-remote ]hwloc_config_prefix[utils/test-hwloc-annotate.sh ]hwloc_config_prefix[utils/test-hwloc-assembler.sh ]hwloc_config_prefix[utils/test-hwloc-calc.sh ]hwloc_config_prefix[utils/test-hwloc-diffpatch.sh ]hwloc_config_prefix[utils/test-hwloc-distances.sh ]hwloc_config_prefix[utils/test-hwloc-distrib.sh ]hwloc_config_prefix[utils/test-hwloc-info.sh ]hwloc_config_prefix[utils/test-hwloc-ls.sh ]hwloc_config_prefix[utils/test-fake-plugin.sh]) # These links are only needed in standalone mode. It would # be nice to m4 foreach this somehow, but whenever I tried diff --git a/utils/Makefile.am b/utils/Makefile.am index 13d434d5..3a064220 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -16,6 +16,7 @@ EXTRA_DIST = \ test-hwloc-annotate.input test-hwloc-annotate.output \ test-hwloc-assembler.input1 test-hwloc-assembler.input2 test-hwloc-assembler.output \ test-hwloc-calc.output \ + test-hwloc-diffpatch.input1 test-hwloc-diffpatch.input2 \ test-hwloc-distances.output \ test-hwloc-distrib.output \ test-hwloc-info.output \ @@ -78,6 +79,7 @@ TESTS = \ test-hwloc-annotate.sh \ test-hwloc-assembler.sh \ test-hwloc-calc.sh \ + test-hwloc-diffpatch.sh \ test-hwloc-distances.sh \ test-hwloc-distrib.sh \ test-hwloc-info.sh \ diff --git a/utils/test-hwloc-diffpatch.input1 b/utils/test-hwloc-diffpatch.input1 new file mode 100644 index 00000000..9c95d7bd --- /dev/null +++ b/utils/test-hwloc-diffpatch.input1 @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/test-hwloc-diffpatch.input2 b/utils/test-hwloc-diffpatch.input2 new file mode 100644 index 00000000..4cb4320b --- /dev/null +++ b/utils/test-hwloc-diffpatch.input2 @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/test-hwloc-diffpatch.sh.in b/utils/test-hwloc-diffpatch.sh.in new file mode 100644 index 00000000..cfd8ddf0 --- /dev/null +++ b/utils/test-hwloc-diffpatch.sh.in @@ -0,0 +1,47 @@ +#!/bin/sh +#-*-sh-*- + +# +# Copyright © 2009-2013 Inria. All rights reserved. +# See COPYING in top-level directory. +# + +HWLOC_top_builddir="@HWLOC_top_builddir@" +diff="$HWLOC_top_builddir/utils/hwloc-diff" +patch="$HWLOC_top_builddir/utils/hwloc-patch" +HWLOC_top_srcdir="@HWLOC_top_srcdir@" + +HWLOC_PLUGINS_PATH=${HWLOC_top_builddir}/src +export HWLOC_PLUGINS_PATH + +if test x@HWLOC_XML_LOCALIZED@ = x1; then + # make sure we use default numeric formats + LANG=C + LC_ALL=C + export LANG LC_ALL +fi + +: ${TMPDIR=/tmp} +{ + tmp=` + (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null + ` && + test -n "$tmp" && test -d "$tmp" +} || { + tmp=$TMPDIR/foo$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || exit $? + +diffoutput="$tmp/test-hwloc-diffpatch.diff.xml" +output1="$tmp/test-hwloc-diffpatch.output1" +output2="$tmp/test-hwloc-diffpatch.output2" + +set -e + +$diff $HWLOC_top_srcdir/utils/test-hwloc-diffpatch.input1 $HWLOC_top_srcdir/utils/test-hwloc-diffpatch.input2 > $diffoutput +cat $diffoutput | $patch $HWLOC_top_srcdir/utils/test-hwloc-diffpatch.input1 - $output1 +$patch -R $HWLOC_top_srcdir/utils/test-hwloc-diffpatch.input2 $diffoutput $output2 + +diff @HWLOC_DIFF_U@ $HWLOC_top_srcdir/utils/test-hwloc-diffpatch.input1 "$output2" +diff @HWLOC_DIFF_U@ $HWLOC_top_srcdir/utils/test-hwloc-diffpatch.input2 "$output1" +rm -rf "$tmp" -- 2.39.5