[Lldb-commits] [lldb] e07e1d4 - [test] Increase test assertion for reasonable auxv values.

Jordan Rupprecht via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 12 19:41:16 PDT 2022


Author: Jordan Rupprecht
Date: 2022-09-12T19:41:06-07:00
New Revision: e07e1d4425f837e5b38336664a246588880834b3

URL: https://github.com/llvm/llvm-project/commit/e07e1d4425f837e5b38336664a246588880834b3
DIFF: https://github.com/llvm/llvm-project/commit/e07e1d4425f837e5b38336664a246588880834b3.diff

LOG: [test] Increase test assertion for reasonable auxv values.

While auxv keys are usually small, e.g. less than 50, they can sometimes be larger, especially on a downstream kernel where a custom auxv entry is intentionally high to avoid conflicting with the standard lower numbers. This test fails on a system with an auxv value bigger than 1000, but instead of putting this test at that value plus one, it looks like 2023 (i.e. `AT_SUN_CAP_HW2`) is another large one out there. Use 2500 as a limit to still have this be a reasonable "small" check but still allow all known auxv keys.

Semi-related change: this test case prints the auxv dict at the trace level, but only _after_ the assertion fails, making it not print what the offending value is as the test case aborts. Move it earlier so we can see what the "unreasonable" auxv value is.

Added: 
    

Modified: 
    lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py
index ac9c7fe9049c0..bf4001fd32e80 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py
@@ -112,11 +112,12 @@ def test_auxv_keys_look_valid(self):
         auxv_dict = self.build_auxv_dict(endian, word_size, auxv_data)
         self.assertIsNotNone(auxv_dict)
 
-        # Verify keys look reasonable.
+        # Verify keys look reasonable. While AUX values are most commonly
+        # small (usually smaller than 50), they can sometimes be larger.
+        self.trace("auxv dict: {}".format(auxv_dict))
         for auxv_key in auxv_dict:
             self.assertTrue(auxv_key >= 1)
-            self.assertTrue(auxv_key <= 1000)
-        self.trace("auxv dict: {}".format(auxv_dict))
+            self.assertTrue(auxv_key <= 2500)
 
     @skipIfWindows
     @expectedFailureNetBSD


        


More information about the lldb-commits mailing list