#!/bin/sh
#-*-sh-*-

#
# Copyright © 2009 CNRS
# Copyright © 2009-2010 INRIA.  All rights reserved.
# Copyright © 2009 Université Bordeaux 1
# See COPYING in top-level directory.
#

: ${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 $?
file="$tmp/test-hwloc-distrib.output"

set -e
(
  ./hwloc-distrib --if synthetic --input "2 2 2" 2
  echo
  ./hwloc-distrib --if synthetic --input "2 2 2" 4
  echo
  ./hwloc-distrib --if synthetic --input "2 2 2" 8
  echo
  ./hwloc-distrib --if synthetic --input "2 2 2" 13
  echo
  ./hwloc-distrib --if synthetic --input "2 2 2" 16
  echo
  ./hwloc-distrib --if synthetic --input "3 3 3" 4
) > "$file"
diff @HWLOC_DIFF_U@ $srcdir/test-hwloc-distrib.output "$file"
rm -rf "$tmp"
