Skip to contentSkip to conversation

Tests: use configured processor count in snapshot tests

PATCH New Michael Jeanson 2 participants 3 messages Mar 15, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/3 Tests: use configured processor count in snapshot tests

From: Jérémie Galarneau <[email protected]>

---
 tests/regression/tools/snapshots/ust_test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/regression/tools/snapshots/ust_test +1 -1
index e839b84..0b8bb24 100755
@@ -182,7 +182,7 @@ function test_ust_local_snapshot ()
 function test_ust_local_snapshot_max_size ()
 {
 	subbuf_size=8192
-	num_cpus=`nproc`
+	num_cpus=$(conf_proc_count)
 
 	# The minimum size limit is min(subbuf_size) * nb_streams
 	max_size=$(($subbuf_size*$num_cpus))
Signature · 6 lines
2.7.0

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#2 lore raw

PATCH 3/3 Tests: use configured processor count in tracefile count test

In reply to a message not in the archive
---
 tests/regression/tools/tracefile-limits/test_tracefile_count | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/regression/tools/tracefile-limits/test_tracefile_count +2 -2
index df1cdce..900150c 100755
@@ -27,10 +27,10 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 STATS_BIN="$TESTDIR/utils/babelstats.pl"
 NUM_TESTS=74
 
-NUM_CPUS=`nproc`
-
 source $TESTDIR/utils/utils.sh
 
+NUM_CPUS=$(conf_proc_count)
+
 if [ ! -x "$TESTAPP_BIN" ]; then
 	BAIL_OUT "No UST events binary detected."
 fi
Signature · 6 lines
2.7.0

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#3 lore raw

Re: [PATCH lttng-tools stable-2.6 1/3] Tests: Introduce conf_proc_count()

In reply to a message not in the archive

All three fixes have been merged to stable-2.6, thanks!

Quoted 47 lines · Michael Jeanson

From: Jérémie Galarneau <[email protected]>

Tests are using the nproc utility which return the number of _available_ CPUs. The distinction between online, available and configured CPUs is subtle, but important.

The number of "online" CPUs can change at runtime as CPUs are hot-plugged. This could happen during a test and result in unexpected results.

The number of "configured" CPUs includes any CPU which may be offline at the time.

The number of "available" CPUs, which is what is returned by the nproc utility, may differ from both "online" and "configured" counts. This is the case in containers which are assigned to a subset of configured CPUs.

---
 tests/utils/utils.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
tests/utils/utils.sh +10 -1
index 9e78dc2..1f116a6 100644
@@ -92,6 +92,16 @@ function randstring()
        echo
 }
 
+# Return the number of _configured_ CPUs.
+function conf_proc_count()
+{
+       getconf _NPROCESSORS_CONF
+       if [ $? -ne 0 ]; then
+               diag "Failed to get the number of configured CPUs"
+       fi
+       echo
+}
+
 function lttng_enable_kernel_event
 {
        local sess_name=$1
--

2.7.0

Signature · 7 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev