test/hash: split into shorter subtests
authorAmit Gupta <agupta3@marvell.com>
Mon, 3 Feb 2020 19:49:08 +0000 (13:49 -0600)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 5 Feb 2020 18:42:24 +0000 (19:42 +0100)
hash_readwrite test was taking too much time to complete in Travis.
Test is split into functional and perf test.
perf test is being moved under perf testsuites in meson.

Signed-off-by: Amit Gupta <agupta3@marvell.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
app/test/autotest_data.py
app/test/meson.build
app/test/test_hash_readwrite.c

index 6deb97b..71db4b3 100644 (file)
@@ -664,8 +664,14 @@ non_parallel_test_list = [
         "Report":  None,
     },
     {
-        "Name":    "Hash read-write concurrency autotest",
-        "Command": "hash_readwrite_autotest",
+        "Name":    "Hash read-write concurrency functional autotest",
+        "Command": "hash_readwrite_func_autotest",
+        "Func":    default_autotest,
+        "Report":  None,
+    },
+    {
+        "Name":    "Hash read-write concurrency perf autotest",
+        "Command": "hash_readwrite_perf_autotest",
         "Func":    default_autotest,
         "Report":  None,
     },
index 22b0cef..08c0ecb 100644 (file)
@@ -233,7 +233,7 @@ fast_test_names = [
         'distributor_autotest',
         'eventdev_common_autotest',
         'fbarray_autotest',
-        'hash_readwrite_autotest',
+        'hash_readwrite_func_autotest',
         'hash_readwrite_lf_autotest',
         'ipsec_autotest',
         'kni_autotest',
@@ -282,6 +282,7 @@ perf_test_names = [
         'stack_perf_autotest',
         'stack_lf_perf_autotest',
         'rand_perf_autotest',
+        'hash_readwrite_perf_autotest',
 ]
 
 driver_test_names = [
index 615767f..635ed5a 100644 (file)
@@ -606,7 +606,7 @@ err:
 }
 
 static int
-test_hash_readwrite_main(void)
+test_hash_rw_perf_main(void)
 {
        /*
         * Variables used to choose different tests.
@@ -615,7 +615,7 @@ test_hash_readwrite_main(void)
         * than writer threads. This is to timing either reader threads or
         * writer threads for performance numbers.
         */
-       int use_htm, use_ext,  reader_faster;
+       int use_htm, reader_faster;
        unsigned int i = 0, core_id = 0;
 
        if (rte_lcore_count() < 3) {
@@ -637,14 +637,6 @@ test_hash_readwrite_main(void)
                printf("Test read-write with Hardware transactional memory\n");
 
                use_htm = 1;
-               use_ext = 0;
-
-               if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
-                       return -1;
-
-               use_ext = 1;
-               if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
-                       return -1;
 
                reader_faster = 1;
                if (test_hash_readwrite_perf(&htm_results, use_htm,
@@ -662,13 +654,6 @@ test_hash_readwrite_main(void)
 
        printf("Test read-write without Hardware transactional memory\n");
        use_htm = 0;
-       use_ext = 0;
-       if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
-               return -1;
-
-       use_ext = 1;
-       if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
-               return -1;
 
        reader_faster = 1;
        if (test_hash_readwrite_perf(&non_htm_results, use_htm,
@@ -705,4 +690,64 @@ test_hash_readwrite_main(void)
        return 0;
 }
 
-REGISTER_TEST_COMMAND(hash_readwrite_autotest, test_hash_readwrite_main);
+static int
+test_hash_rw_func_main(void)
+{
+       /*
+        * Variables used to choose different tests.
+        * use_htm indicates if hardware transactional memory should be used.
+        * reader_faster indicates if the reader threads should finish earlier
+        * than writer threads. This is to timing either reader threads or
+        * writer threads for performance numbers.
+        */
+       int use_htm, use_ext;
+       unsigned int i = 0, core_id = 0;
+
+       if (rte_lcore_count() < 3) {
+               printf("Not enough cores for hash_readwrite_autotest, expecting at least 3\n");
+               return TEST_SKIPPED;
+       }
+
+       RTE_LCORE_FOREACH_SLAVE(core_id) {
+               slave_core_ids[i] = core_id;
+               i++;
+       }
+
+       setlocale(LC_NUMERIC, "");
+
+       if (rte_tm_supported()) {
+               printf("Hardware transactional memory (lock elision) "
+                       "is supported\n");
+
+               printf("Test read-write with Hardware transactional memory\n");
+
+               use_htm = 1;
+               use_ext = 0;
+
+               if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
+                       return -1;
+
+               use_ext = 1;
+               if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
+                       return -1;
+
+       } else {
+               printf("Hardware transactional memory (lock elision) "
+                       "is NOT supported\n");
+       }
+
+       printf("Test read-write without Hardware transactional memory\n");
+       use_htm = 0;
+       use_ext = 0;
+       if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
+               return -1;
+
+       use_ext = 1;
+       if (test_hash_readwrite_functional(use_ext, use_htm) < 0)
+               return -1;
+
+       return 0;
+}
+
+REGISTER_TEST_COMMAND(hash_readwrite_func_autotest, test_hash_rw_func_main);
+REGISTER_TEST_COMMAND(hash_readwrite_perf_autotest, test_hash_rw_perf_main);