Debian Codegraph @

utils/lstopo/test-lstopo.sh.in

raw
1 #!/bin/sh
2 #-*-sh-*-
3
4 #
5 # SPDX-License-Identifier: BSD-3-Clause
6 # Copyright © 2009 CNRS
7 # Copyright © 2009-2024 Inria. All rights reserved.
8 # Copyright © 2009, 2011 Université Bordeaux
9 # Copyright © 2020 Hewlett Packard Enterprise. All rights reserved.
10 # See COPYING in top-level directory.
11 #
12
13 HWLOC_top_srcdir="@HWLOC_top_srcdir@"
14 HWLOC_top_builddir="@HWLOC_top_builddir@"
15 srcdir="$HWLOC_top_srcdir/utils/lstopo"
16 builddir="$HWLOC_top_builddir/utils/lstopo"
17 ls="$builddir/lstopo-no-graphics"
18
19 HWLOC_PLUGINS_PATH=${HWLOC_top_builddir}/hwloc/.libs
20 export HWLOC_PLUGINS_PATH
21
22 HWLOC_DEBUG_CHECK=1
23 export HWLOC_DEBUG_CHECK
24
25 HWLOC_DONT_ADD_VERSION_INFO=1
26 export HWLOC_DONT_ADD_VERSION_INFO
27
28 : ${TMPDIR=/tmp}
29 {
30 tmp=`
31 (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
32 ` &&
33 test -n "$tmp" && test -d "$tmp"
34 } || {
35 tmp=$TMPDIR/foo$$-$RANDOM
36 (umask 077 && mkdir "$tmp")
37 } || exit $?
38 echo "Outputs will be sent to $tmp"
39
40 unset DISPLAY
41
42 set -e
43
44 echo "**** Export once here to see what the platform looks like:"
45 $ls -
46
47 echo "**** Check that we don't crash for the local topology (we can't check the exact output):"
48 echo "** Textual output in $tmp/test.console ..."
49 $ls - > $tmp/test.console
50 echo "** Verbose in $tmp/test.console_verbose ..."
51 $ls -v > $tmp/test.console_verbose
52 echo "** Verbose with cpusets in $tmp/test.cpuset_verbose ..."
53 $ls -c -v > $tmp/test.cpuset_verbose
54 echo "** Verbose with taskset sets in $tmp/test.taskset ..."
55 $ls --cpuset-output-format taskset -v > $tmp/test.taskset
56
57 echo "** Merged topology in $tmp/test.merge ..."
58 $ls --merge > $tmp/test.merge
59 echo "** Without any filtering in $tmp/test.filternone ..."
60 $ls --filter all:none > $tmp/test.filternone
61 echo "** With everything filtered out in $tmp/test.filterall ..."
62 $ls --filter all:all > $tmp/test.filterall
63
64 echo "** Without I/O in $tmp/test.no-io ..."
65 $ls --no-io > $tmp/test.no-io
66 echo "** Without bridges in $tmp/test.no-bridges ..."
67 $ls --no-bridges > $tmp/test.no-bridges
68 echo "** With all I/Os in $tmp/test.whole-io ..."
69 $ls --whole-io > $tmp/test.whole-io
70 echo "** Verbose with all I/Os in $tmp/test.wholeio_verbose ..."
71 $ls -v --whole-io > $tmp/test.wholeio_verbose
72
73 echo "** With disallowed objects in $tmp/test.disallowed ..."
74 $ls --disallowed > $tmp/test.disallowed
75 echo "** With --top in $tmp/test.top ..."
76 $ls --top > $tmp/test.top
77
78 echo "** ASCII output in $tmp/test.ascii ..."
79 $ls $tmp/test.ascii
80
81 echo "** LaTeX Tikzpicture output in $tmp/test.tikz ..."
82 $ls $tmp/test.tikz
83 echo "** LaTeX Tikzpicture output in $tmp/test.tex ..."
84 $ls $tmp/test.tex
85 if [ -n "$PDFLATEX" ]; then
86 echo "** Test validity of the generated LaTeX output from $tmp/test.tikz ..."
87 (cd $tmp && $PDFLATEX test.tikz && $PDFLATEX test.tex)
88 fi
89
90 echo "** FIG output in $tmp/test.fig ..."
91 $ls $tmp/test.fig
92 echo "** Native SVG output in $tmp/test.nativesvg ..."
93 $ls $tmp/test.nativesvg
94 echo "** (Native by default) SVG output in $tmp/test.svg ..."
95 $ls $tmp/test.svg
96
97 echo "** XML output in $tmp/test.xml ..."
98 $ls $tmp/test.xml
99 echo "** Minimalistic XML output in $tmp/test.mini.xml ..."
100 HWLOC_LIBXML_EXPORT=0 $ls $tmp/test.mini.xml
101 echo "** XMLv1 output in $tmp/test.v1.xml ..."
102 $ls --export-xml-flags 1 $tmp/test.v1.xml
103
104 file="$tmp/test-lstopo.output"
105 echo "**** Import from synthetic so that we can check some exact outputs in $file ..."
106 (
107 SI="pa:1 no:2 co:1 l2:2 2"
108 echo "** Default output..."
109 $ls -i "$SI" -
110 echo "** OS-index output merged..."
111 $ls -i "$SI" - -p --merge
112 echo "** Logical-index verbose output..."
113 $ls -i "$SI" - -l --verbose --verbose
114 echo "** Export to synthetic..."
115 $ls -i "$SI" -.synthetic
116 echo "** Export to XML after changing disallowed..."
117 $ls -i "$SI" -.xml --allow 0x30 --allow nodeset=0x2
118 echo "** Restrict flag cpuless..."
119 $ls -i "node:4 pu:4" --restrict 0xf0 --restrict-flags cpuless
120 echo "** Restrict flag t\$,memless..."
121 $ls -i "node:4 pu:4" --restrict 0x3 --restrict-flags t\$,memless
122 echo "** Restrict flag none..."
123 $ls -i "node:4 pu:4" --restrict 0x3 --restrict-flags none
124 echo "** Export synthetic flag extended,attrs,v1..."
125 $ls -i "node:4 pu:4" -.synthetic --export-synthetic-flags extended,attrs,v1
126 echo "** Export XML flag v1..."
127 $ls -i "node:4 pu:4" -.xml --export-xml-flags v1
128 echo "** Topology flag disallowed..."
129 $ls -i "node:4 pu:4" - --allow 0xf --flags disallowed -v
130 ) > "$file"
131 @DIFF@ @HWLOC_DIFF_U@ @HWLOC_DIFF_W@ $srcdir/test-lstopo.output "$file"
132
133 if which archivemount >/dev/null 2>/dev/null && test x@HWLOC_HAVE_LINUX@ = x1; then
134 echo "**** Archivemount'ing a Linux fsroot archive ..."
135 file="$tmp/test-lstopo.archivemount.fsroot.output"
136 $ls -i $HWLOC_top_srcdir/tests/hwloc/linux/16amd64-8n2c.tar.bz2 -v - | egrep -v "^assuming " > "$file"
137 @DIFF@ @HWLOC_DIFF_U@ @HWLOC_DIFF_W@ $HWLOC_top_srcdir/tests/hwloc/linux/16amd64-8n2c.output "$file"
138 if test x@HWLOC_HAVE_X86_CPUID@ = x1; then
139 echo "**** Archivemount'ing a x86 CPUID archive ..."
140 file="$tmp/test-lstopo.archivemount.cpuid.output"
141 HWLOC_XML_EXPORT_SUPPORT=0
142 export HWLOC_XML_EXPORT_SUPPORT
143 $ls -i $HWLOC_top_srcdir/tests/hwloc/x86/Intel-Skylake-2xXeon6140.tar.bz2 --of xml - | sed -e 's/ gp_index="[0-9]*"//' | egrep -v "^assuming " > "$file"
144 @DIFF@ @HWLOC_DIFF_U@ @HWLOC_DIFF_W@ $HWLOC_top_srcdir/tests/hwloc/x86/Intel-Skylake-2xXeon6140.output "$file"
145 fi
146 fi
147
148 rm -rf "$tmp"