Skip to content

Commit

Permalink
tests/lstopo: check some actual outputs
Browse files Browse the repository at this point in the history
The diff'ed file was empty so far because we can't enforce the
outputs for the local platform.

Add more cases with synthetic inputs and actually check their outputs
in the diff'ed file.

Add some verbose messages about other non-checked outputs from the local machine.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Jun 19, 2018
1 parent 175ddba commit 7ed77d2
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 25 deletions.
102 changes: 102 additions & 0 deletions utils/lstopo/test-lstopo.output
@@ -0,0 +1,102 @@
** Default output...
Machine (2048MB total) + Package L#0
Core L#0
NUMANode L#0 (P#0 1024MB)
L2 L#0 (4096KB)
PU L#0 (P#0)
PU L#1 (P#1)
L2 L#1 (4096KB)
PU L#2 (P#2)
PU L#3 (P#3)
Core L#1
NUMANode L#1 (P#1 1024MB)
L2 L#2 (4096KB)
PU L#4 (P#4)
PU L#5 (P#5)
L2 L#3 (4096KB)
PU L#6 (P#6)
PU L#7 (P#7)
** OS-index output merged...
Machine (2048MB total)
Core P#0
NUMANode P#0 (1024MB)
L2 (4096KB)
PU P#0
PU P#1
L2 (4096KB)
PU P#2
PU P#3
Core P#1
NUMANode P#1 (1024MB)
L2 (4096KB)
PU P#4
PU P#5
L2 (4096KB)
PU P#6
PU P#7
** Logical-index verbose output...
assuming `pa:1 no:2 co:1 l2:2 2' is a synthetic topology description
Machine (total=2097152KB Backend=Synthetic SyntheticDescription="pa:1 no:2 co:1 l2:2 2")
Package L#0 (total=2097152KB)
Core L#0 (total=1048576KB)
NUMANode L#0 (local=1048576KB total=1048576KB)
L2Cache L#0 (size=4096KB linesize=64)
PU L#0
PU L#1
L2Cache L#1 (size=4096KB linesize=64)
PU L#2
PU L#3
Core L#1 (total=1048576KB)
NUMANode L#1 (local=1048576KB total=1048576KB)
L2Cache L#2 (size=4096KB linesize=64)
PU L#4
PU L#5
L2Cache L#3 (size=4096KB linesize=64)
PU L#6
PU L#7
depth 0: 1 Machine (type #0)
depth 1: 1 Package (type #1)
depth 2: 2 Core (type #2)
depth 3: 4 L2Cache (type #5)
depth 4: 8 PU (type #3)
Special depth -3: 2 NUMANode (type #13)
Topology not from this system
** Export to synthetic...
Package:1 Core:2 [NUMANode(memory=1073741824)] L2Cache:2(size=4194304) PU:2
** Export to XML...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topology SYSTEM "hwloc2.dtd">
<topology version="2.0">
<object type="Machine" os_index="0" cpuset="0x000000ff" complete_cpuset="0x000000ff" allowed_cpuset="0x000000ff" nodeset="0x00000003" complete_nodeset="0x00000003" allowed_nodeset="0x00000003" gp_index="1">
<info name="Backend" value="Synthetic"/>
<info name="SyntheticDescription" value="pa:1 no:2 co:1 l2:2 2"/>
<object type="Package" os_index="0" cpuset="0x000000ff" complete_cpuset="0x000000ff" nodeset="0x00000003" complete_nodeset="0x00000003" gp_index="18">
<object type="Core" os_index="0" cpuset="0x0000000f" complete_cpuset="0x0000000f" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="8">
<object type="NUMANode" os_index="0" cpuset="0x0000000f" complete_cpuset="0x0000000f" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="9" local_memory="1073741824">
<page_type size="4096" count="262144"/>
</object>
<object type="L2Cache" cpuset="0x00000003" complete_cpuset="0x00000003" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="4" cache_size="4194304" depth="2" cache_linesize="64" cache_associativity="0" cache_type="0">
<object type="PU" os_index="0" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="2"/>
<object type="PU" os_index="1" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="3"/>
</object>
<object type="L2Cache" cpuset="0x0000000c" complete_cpuset="0x0000000c" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="7" cache_size="4194304" depth="2" cache_linesize="64" cache_associativity="0" cache_type="0">
<object type="PU" os_index="2" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="5"/>
<object type="PU" os_index="3" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="6"/>
</object>
</object>
<object type="Core" os_index="1" cpuset="0x000000f0" complete_cpuset="0x000000f0" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="16">
<object type="NUMANode" os_index="1" cpuset="0x000000f0" complete_cpuset="0x000000f0" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="17" local_memory="1073741824">
<page_type size="4096" count="262144"/>
</object>
<object type="L2Cache" cpuset="0x00000030" complete_cpuset="0x00000030" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="12" cache_size="4194304" depth="2" cache_linesize="64" cache_associativity="0" cache_type="0">
<object type="PU" os_index="4" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="10"/>
<object type="PU" os_index="5" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="11"/>
</object>
<object type="L2Cache" cpuset="0x000000c0" complete_cpuset="0x000000c0" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="15" cache_size="4194304" depth="2" cache_linesize="64" cache_associativity="0" cache_type="0">
<object type="PU" os_index="6" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="13"/>
<object type="PU" os_index="7" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000002" complete_nodeset="0x00000002" gp_index="14"/>
</object>
</object>
</object>
</object>
</topology>
88 changes: 63 additions & 25 deletions utils/lstopo/test-lstopo.sh.in
Expand Up @@ -3,11 +3,12 @@

#
# Copyright © 2009 CNRS
# Copyright © 2009-2017 Inria. All rights reserved.
# Copyright © 2009-2018 Inria. All rights reserved.
# Copyright © 2009, 2011 Université Bordeaux
# See COPYING in top-level directory.
#

HWLOC_VERSION="@HWLOC_VERSION@"
HWLOC_top_srcdir="@HWLOC_top_srcdir@"
HWLOC_top_builddir="@HWLOC_top_builddir@"
srcdir="$HWLOC_top_srcdir/utils/lstopo"
Expand All @@ -33,35 +34,72 @@ export HWLOC_DONT_ADD_VERSION_INFO
tmp=$TMPDIR/foo$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || exit $?
file="$tmp/test-lstopo.output"
echo "Outputs will be sent to $tmp"

unset DISPLAY

set -e
$ls

echo "**** Export once here to see what the platform looks like:"
$ls -

echo "**** Check that we don't crash for the local topology (we can't check the exact output):"
echo "** Textual output in $tmp/test.console ..."
$ls - > $tmp/test.console
echo "** Verbose in $tmp/test.console_verbose ..."
$ls -v > $tmp/test.console_verbose
echo "** Verbose with cpusets in $tmp/test.cpuset_verbose ..."
$ls -c -v > $tmp/test.cpuset_verbose
echo "** Verbose with taskset sets in $tmp/test.taskset ..."
$ls --taskset -v > $tmp/test.taskset

echo "** Merged topology in $tmp/test.merge ..."
$ls --merge > $tmp/test.merge
echo "** Without any filtering in $tmp/test.filternone ..."
$ls --filter all:none > $tmp/test.filternone
echo "** With everything filtered out in $tmp/test.filterall ..."
$ls --filter all:all > $tmp/test.filterall

echo "** Without I/O in $tmp/test.no-io ..."
$ls --no-io > $tmp/test.no-io
echo "** Without bridges in $tmp/test.no-bridges ..."
$ls --no-bridges > $tmp/test.no-bridges
echo "** With all I/Os in $tmp/test.whole-io ..."
$ls --whole-io > $tmp/test.whole-io
echo "** Verbose with all I/Os in $tmp/test.wholeio_verbose ..."
$ls -v --whole-io > $tmp/test.wholeio_verbose

echo "** With disallowed objects in $tmp/test.whole-system ..."
$ls --whole-system > $tmp/test.whole-system
echo "** With --top in $tmp/test.top ..."
$ls --top > $tmp/test.top

echo "** ASCII output in $tmp/test.ascii ..."
$ls $tmp/test.ascii
echo "** FIG output in $tmp/test.fig ..."
$ls $tmp/test.fig

echo "** XML output in $tmp/test.xml ..."
$ls $tmp/test.xml
echo "** Minimalistic XML output in test.xml ..."
HWLOC_LIBXML_EXPORT=0 $ls $tmp/test.mini.xml
echo "** XMLv1 output in test.v1.xml ..."
$ls --export-xml-flags 1 $tmp/test.v1.xml

file="$tmp/test-lstopo.output"
echo "**** Import from synthetic so that we can check some exact outputs in $file ..."
(
$ls > $tmp/test.console
$ls -v > $tmp/test.console_verbose
$ls -c -v > $tmp/test.cpuset_verbose
$ls --taskset -v > $tmp/test.taskset

$ls --merge > $tmp/test.merge
$ls --filter all:none > $tmp/test.none
$ls --filter all:all > $tmp/test.all

$ls --no-io > $tmp/test.no-io
$ls --no-bridges > $tmp/test.no-bridges
$ls --whole-io > $tmp/test.whole-io
$ls -v --whole-io > $tmp/test.wholeio_verbose

$ls --whole-system > $tmp/test.whole-system
$ls --ps > $tmp/test.
$ls $tmp/test.txt
$ls $tmp/test.fig
$ls -f $tmp/test.xml
HWLOC_LIBXML_EXPORT=0 $ls -f $tmp/test.xml
$ls --export-xml-flags 1 -f $tmp/test.v1.xml
$ls --input "pa:1 no:2 co:1 l2:2 2" $tmp/test.synthetic
SI="pa:1 no:2 co:1 l2:2 2"
echo "** Default output..."
$ls -i "$SI" -
echo "** OS-index output merged..."
$ls -i "$SI" - -p --merge
echo "** Logical-index verbose output..."
$ls -i "$SI" - -l --verbose
echo "** Export to synthetic..."
$ls -i "$SI" -.synthetic
echo "** Export to XML..."
$ls -i "$SI" -.xml
) > "$file"
diff @HWLOC_DIFF_U@ $srcdir/test-lstopo.output "$file"
rm -rf "$tmp"

0 comments on commit 7ed77d2

Please sign in to comment.