daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
Brian Stinson 2593d8
From a1ed6bfc5a8c40377b9f1cab1acc3c67a9529427 Mon Sep 17 00:00:00 2001
Brian Stinson 2593d8
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Brian Stinson 2593d8
Date: Tue, 21 May 2019 09:01:34 +0200
Brian Stinson 2593d8
Subject: [PATCH] test-cpu-set-util: add simple test for
Brian Stinson 2593d8
 cpus_in_affinity_mask()
Brian Stinson 2593d8
Brian Stinson 2593d8
(cherry picked from commit 9d1345f0657c707df89b41b2738776efb40aec8e)
Brian Stinson 2593d8
Brian Stinson 2593d8
Related: #1734787
Brian Stinson 2593d8
---
Brian Stinson 2593d8
 src/test/test-cpu-set-util.c | 9 +++++++++
Brian Stinson 2593d8
 1 file changed, 9 insertions(+)
Brian Stinson 2593d8
Brian Stinson 2593d8
diff --git a/src/test/test-cpu-set-util.c b/src/test/test-cpu-set-util.c
Brian Stinson 2593d8
index b9ec29af66..e87e0ca6e6 100644
Brian Stinson 2593d8
--- a/src/test/test-cpu-set-util.c
Brian Stinson 2593d8
+++ b/src/test/test-cpu-set-util.c
Brian Stinson 2593d8
@@ -157,6 +157,14 @@ static void test_parse_cpu_set(void) {
Brian Stinson 2593d8
         cpu_set_reset(&c);
Brian Stinson 2593d8
 }
Brian Stinson 2593d8
 
Brian Stinson 2593d8
+static void test_cpus_in_affinity_mask(void) {
Brian Stinson 2593d8
+        int r;
Brian Stinson 2593d8
+
Brian Stinson 2593d8
+        r = cpus_in_affinity_mask();
Brian Stinson 2593d8
+        assert(r > 0);
Brian Stinson 2593d8
+        log_info("cpus_in_affinity_mask: %d", r);
Brian Stinson 2593d8
+}
Brian Stinson 2593d8
+
Brian Stinson 2593d8
 int main(int argc, char *argv[]) {
Brian Stinson 2593d8
         log_info("CPU_ALLOC_SIZE(1) = %zu", CPU_ALLOC_SIZE(1));
Brian Stinson 2593d8
         log_info("CPU_ALLOC_SIZE(9) = %zu", CPU_ALLOC_SIZE(9));
Brian Stinson 2593d8
@@ -167,6 +175,7 @@ int main(int argc, char *argv[]) {
Brian Stinson 2593d8
         log_info("CPU_ALLOC_SIZE(8191) = %zu", CPU_ALLOC_SIZE(8191));
Brian Stinson 2593d8
 
Brian Stinson 2593d8
         test_parse_cpu_set();
Brian Stinson 2593d8
+        test_cpus_in_affinity_mask();
Brian Stinson 2593d8
 
Brian Stinson 2593d8
         return 0;
Brian Stinson 2593d8
 }