Title: [286773] trunk/Source/bmalloc
Revision
286773
Author
[email protected]
Date
2021-12-09 03:23:27 -0800 (Thu, 09 Dec 2021)

Log Message

[libpas] Fix up missing header includes and build guards in unit tests
https://bugs.webkit.org/show_bug.cgi?id=234007

Patch by Zan Dobersek <[email protected]> on 2021-12-09
Reviewed by Yusuke Suzuki.

Add missing header inclusions in different libpas unit test sources
to avoid build problems.

In IsoHeapChaosTests.cpp, Mach-specific thread-related header inclusion
and usage is put inside PAS_OS(DARWIN) build guards. On Linux, the
enumerator sub-tests that utilize this thread suspension and resuming
functionality are disabled.

* libpas/src/test/ExpendableMemoryTests.cpp:
* libpas/src/test/IsoHeapChaosTests.cpp:
(std::testAllocationChaos):
* libpas/src/test/IsoHeapPageSharingTests.cpp:
* libpas/src/test/IsoHeapPartialAndBaselineTests.cpp:
* libpas/src/test/RaceTests.cpp:
* libpas/src/test/TestHarness.cpp:
* libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp:

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (286772 => 286773)


--- trunk/Source/bmalloc/ChangeLog	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/ChangeLog	2021-12-09 11:23:27 UTC (rev 286773)
@@ -1,3 +1,27 @@
+2021-12-09  Zan Dobersek  <[email protected]>
+
+        [libpas] Fix up missing header includes and build guards in unit tests
+        https://bugs.webkit.org/show_bug.cgi?id=234007
+
+        Reviewed by Yusuke Suzuki.
+
+        Add missing header inclusions in different libpas unit test sources
+        to avoid build problems.
+
+        In IsoHeapChaosTests.cpp, Mach-specific thread-related header inclusion
+        and usage is put inside PAS_OS(DARWIN) build guards. On Linux, the
+        enumerator sub-tests that utilize this thread suspension and resuming
+        functionality are disabled.
+
+        * libpas/src/test/ExpendableMemoryTests.cpp:
+        * libpas/src/test/IsoHeapChaosTests.cpp:
+        (std::testAllocationChaos):
+        * libpas/src/test/IsoHeapPageSharingTests.cpp:
+        * libpas/src/test/IsoHeapPartialAndBaselineTests.cpp:
+        * libpas/src/test/RaceTests.cpp:
+        * libpas/src/test/TestHarness.cpp:
+        * libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp:
+
 2021-12-08  Zan Dobersek  <[email protected]>
 
         [libpas] Guard Darwin-specific malloc zone usage in mbmalloc sources

Modified: trunk/Source/bmalloc/libpas/src/test/ExpendableMemoryTests.cpp (286772 => 286773)


--- trunk/Source/bmalloc/libpas/src/test/ExpendableMemoryTests.cpp	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/libpas/src/test/ExpendableMemoryTests.cpp	2021-12-09 11:23:27 UTC (rev 286773)
@@ -28,6 +28,8 @@
 #if PAS_ENABLE_BMALLOC
 
 #include "bmalloc_heap.h"
+#include <condition_variable>
+#include <mutex>
 #include "pas_compact_expendable_memory.h"
 #include "pas_large_expendable_memory.h"
 #include "pas_segregated_heap.h"

Modified: trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp (286772 => 286773)


--- trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp	2021-12-09 11:23:27 UTC (rev 286773)
@@ -40,10 +40,10 @@
 #include "iso_test_heap_config.h"
 #include "jit_heap.h"
 #include "jit_heap_config.h"
-#include <mach/thread_act.h>
 #include <map>
 #include "minalign32_heap.h"
 #include "minalign32_heap_config.h"
+#include <mutex>
 #include "pagesize64k_heap.h"
 #include "pagesize64k_heap_config.h"
 #include "pas_all_heaps.h"
@@ -63,6 +63,10 @@
 #include <vector>
 #include <thread>
 
+#if PAS_OS(DARWIN)
+#include <mach/thread_act.h>
+#endif
+
 using namespace std;
 
 namespace {
@@ -610,10 +614,12 @@
                 }
             }
             
+#if PAS_OS(DARWIN)
             for (pthread_t thread : runningThreads) {
                 kern_return_t result = thread_suspend(pthread_mach_thread_np(thread));
                 PAS_ASSERT(result == KERN_SUCCESS);
             }
+#endif
 
             pageRanges.clear();
             readerCache.clear();
@@ -806,10 +812,12 @@
             if (!(numEnumerations % 50))
                 cout << "    Did " << numEnumerations << " enumerations.\n";
             
+#if PAS_OS(DARWIN)
             for (pthread_t thread : runningThreads) {
                 kern_return_t result = thread_resume(pthread_mach_thread_np(thread));
                 PAS_ASSERT(result == KERN_SUCCESS);
             }
+#endif
 
             lock.unlock();
         };
@@ -927,6 +935,12 @@
 
 void addTheTests(unsigned multiplier, bool testEnumerator)
 {
+#if PAS_OS(LINUX)
+    // FIXME: thread suspension/resume in libpas, required for enumerator tests, is missing on Linux
+    // http://webkit.org/b/234071
+    testEnumerator = false;
+#endif
+
     ADD_TEST(testAllocationChaos(1, 0, 1000 * multiplier, 1000000 * multiplier, uniformlyRandomUpTo5000, 10000000 * multiplier, false));
     ADD_TEST(testAllocationChaos(1, 10, 1000 * multiplier, 500000 * multiplier, sometimesSmallSometimesBig, 10000000 * multiplier, false));
     ADD_TEST(testAllocationChaos(10, 0, 1000 * multiplier, 200000 * multiplier, sometimesSmallSometimesBig, 10000000 * multiplier, false));

Modified: trunk/Source/bmalloc/libpas/src/test/IsoHeapPageSharingTests.cpp (286772 => 286773)


--- trunk/Source/bmalloc/libpas/src/test/IsoHeapPageSharingTests.cpp	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/libpas/src/test/IsoHeapPageSharingTests.cpp	2021-12-09 11:23:27 UTC (rev 286773)
@@ -29,10 +29,12 @@
 
 #include "HeapLocker.h"
 #include "LargeSharingPoolDump.h"
+#include <condition_variable>
 #include <functional>
 #include "iso_heap.h"
 #include "iso_heap_config.h"
 #include "iso_heap_innards.h"
+#include <mutex>
 #include "pas_all_heaps.h"
 #include "pas_baseline_allocator_table.h"
 #include "pas_heap.h"

Modified: trunk/Source/bmalloc/libpas/src/test/IsoHeapPartialAndBaselineTests.cpp (286772 => 286773)


--- trunk/Source/bmalloc/libpas/src/test/IsoHeapPartialAndBaselineTests.cpp	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/libpas/src/test/IsoHeapPartialAndBaselineTests.cpp	2021-12-09 11:23:27 UTC (rev 286773)
@@ -32,6 +32,7 @@
 #include "iso_heap_config.h"
 #include "iso_test_heap.h"
 #include "iso_test_heap_config.h"
+#include <mutex>
 #include "pas_baseline_allocator_table.h"
 #include "pas_heap.h"
 #include "pas_random.h"

Modified: trunk/Source/bmalloc/libpas/src/test/RaceTests.cpp (286772 => 286773)


--- trunk/Source/bmalloc/libpas/src/test/RaceTests.cpp	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/libpas/src/test/RaceTests.cpp	2021-12-09 11:23:27 UTC (rev 286773)
@@ -24,6 +24,7 @@
  */
 
 #include "TestHarness.h"
+#include <condition_variable>
 #include <functional>
 #include "iso_heap.h"
 #include "iso_heap_config.h"

Modified: trunk/Source/bmalloc/libpas/src/test/TestHarness.cpp (286772 => 286773)


--- trunk/Source/bmalloc/libpas/src/test/TestHarness.cpp	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/libpas/src/test/TestHarness.cpp	2021-12-09 11:23:27 UTC (rev 286773)
@@ -26,6 +26,7 @@
 #include "TestHarness.h"
 
 #include "Verifier.h"
+#include <atomic>
 #include "iso_heap_config.h"
 #include "iso_test_heap_config.h"
 #include "jit_heap.h"

Modified: trunk/Source/bmalloc/libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp (286772 => 286773)


--- trunk/Source/bmalloc/libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp	2021-12-09 10:34:36 UTC (rev 286772)
+++ trunk/Source/bmalloc/libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp	2021-12-09 11:23:27 UTC (rev 286773)
@@ -32,6 +32,7 @@
 #include "thingy_heap_config.h"
 #include <functional>
 #include <map>
+#include <mutex>
 #include "pas_all_heaps.h"
 #include "pas_baseline_allocator_table.h"
 #include "pas_bootstrap_free_heap.h"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to