1#!/bin/sh
2#-*-sh-*-
3
4#
5# Copyright © 2009 CNRS
6# Copyright © 2009-2017 Inria.  All rights reserved.
7# Copyright © 2009 Université Bordeaux
8# See COPYING in top-level directory.
9#
10
11HWLOC_top_builddir="@HWLOC_top_builddir@"
12distrib="$HWLOC_top_builddir/utils/hwloc/hwloc-distrib"
13HWLOC_top_srcdir="@HWLOC_top_srcdir@"
14
15HWLOC_PLUGINS_PATH=${HWLOC_top_builddir}/src
16export HWLOC_PLUGINS_PATH
17
18: ${TMPDIR=/tmp}
19{
20  tmp=`
21    (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
22  ` &&
23  test -n "$tmp" && test -d "$tmp"
24} || {
25  tmp=$TMPDIR/foo$$-$RANDOM
26  (umask 077 && mkdir "$tmp")
27} || exit $?
28file="$tmp/test-hwloc-distrib.output"
29
30set -e
31(
32  $distrib --if synthetic --input "2 2 2" 2
33  echo
34  $distrib --if synthetic --input "2 2 2" 4
35  echo
36  $distrib --if synthetic --input "2 2 2" 8
37  echo
38  $distrib --if synthetic --input "2 2 2" 13
39  echo
40  $distrib --if synthetic --input "2 2 2" 16
41  echo
42  $distrib --if synthetic --input "3 3 3" 4
43  echo
44  $distrib --if synthetic --input "3 3 3" 4 --single
45  echo
46  $distrib --if synthetic --input "3 3 3" 4 --reverse
47  echo
48  $distrib --if synthetic --input "3 3 3" 4 --reverse --single
49  echo
50  $distrib --if synthetic --input "4 4" 2
51  echo
52  $distrib --if synthetic --input "4 4" 2 --single
53  echo
54  $distrib --if synthetic --input "4 4" 2 --reverse --single
55  echo
56  $distrib --if synthetic --input "4 4 4 4" 19
57  echo
58
59  $distrib --if synthetic --input "2 2 2 2" 9
60  echo
61  $distrib --if synthetic --input "2 2 2 2" --from pu 9
62  echo
63  $distrib --if synthetic --input "2 2 2 2" --to core 9
64  echo
65) > "$file"
66diff @HWLOC_DIFF_U@ $HWLOC_top_srcdir/utils/hwloc/test-hwloc-distrib.output "$file"
67rm -rf "$tmp"
68