1#!/bin/sh
2#-*-sh-*-
3
4#
5# Copyright © 2009-2013 Inria.  All rights reserved.
6# See COPYING in top-level directory.
7#
8
9HWLOC_top_builddir="@HWLOC_top_builddir@"
10diff="$HWLOC_top_builddir/utils/hwloc/hwloc-diff"
11patch="$HWLOC_top_builddir/utils/hwloc/hwloc-patch"
12HWLOC_top_srcdir="@HWLOC_top_srcdir@"
13
14HWLOC_PLUGINS_PATH=${HWLOC_top_builddir}/src
15export HWLOC_PLUGINS_PATH
16
17if test x@HWLOC_XML_LOCALIZED@ = x1; then
18  # make sure we use default numeric formats
19  LANG=C
20  LC_ALL=C
21  export LANG LC_ALL
22fi
23
24: ${TMPDIR=/tmp}
25{
26  tmp=`
27    (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
28  ` &&
29  test -n "$tmp" && test -d "$tmp"
30} || {
31  tmp=$TMPDIR/foo$$-$RANDOM
32  (umask 077 && mkdir "$tmp")
33} || exit $?
34
35cd "$tmp"
36diffoutput="test-hwloc-diffpatch.diff.xml"
37output1="test-hwloc-diffpatch.output1"
38output2="test-hwloc-diffpatch.output2"
39
40set -e
41
42$diff $HWLOC_top_srcdir/utils/hwloc/test-hwloc-diffpatch.input1 $HWLOC_top_srcdir/utils/hwloc/test-hwloc-diffpatch.input2 > $diffoutput
43cp $HWLOC_top_srcdir/utils/hwloc/test-hwloc-diffpatch.input1 .
44#cat $diffoutput | $patch $HWLOC_top_srcdir/utils/hwloc/test-hwloc-diffpatch.input1 - $output1
45cat $diffoutput | $patch refname - $output1
46$patch -R $HWLOC_top_srcdir/utils/hwloc/test-hwloc-diffpatch.input2 $diffoutput $output2
47
48diff -u $HWLOC_top_srcdir/utils/hwloc/test-hwloc-diffpatch.input1 "$output2"
49diff -u $HWLOC_top_srcdir/utils/hwloc/test-hwloc-diffpatch.input2 "$output1"
50
51cd ..
52rm -rf "$tmp"
53