diff --git a/tests/runtime/common/gc/CMakeLists.txt b/tests/runtime/common/gc/CMakeLists.txt index 3ae0b8790e53ca1d4aa67888f44c1001c2e9c969..88e696d3df952381917b814080c4bd6142627b8a 100644 --- a/tests/runtime/common/gc/CMakeLists.txt +++ b/tests/runtime/common/gc/CMakeLists.txt @@ -133,7 +133,7 @@ add_dependencies(mm_tests # Use --gc-trigger-type=debug-never to control GC in the test. # In the test we don't need the runtime triggers GC during allocation. -panda_add_ecma_gc_test(FILE startGc.js OPTIONS "--gc-trigger-type=debug-never") +panda_add_ecma_gc_test(FILE startGc.js OPTIONS "--gc-trigger-type=debug-never" "--g1-region-garbage-rate-threshold=0") panda_add_ecma_gc_test(FILE scheduleGc.js OPTIONS "--gc-trigger-type=debug-never" "--gc-use-nth-alloc-trigger=true") panda_add_ecma_gc_test(FILE spaceTypeTest.js OPTIONS "--gc-type=g1-gc" "--run-gc-in-place=true") panda_add_ecma_gc_test(FILE concurrent.js OPTIONS "--gc-type=g1-gc" "--gc-trigger-type=debug-never") diff --git a/tests/runtime/common/gc/startGc.js b/tests/runtime/common/gc/startGc.js index 22efb0eb7cc34f4d8fd74cdbe499ac9eb5107cbd..b2c8d83cf2ccd4da78105e6c71a18ebc1c8b4b09 100644 --- a/tests/runtime/common/gc/startGc.js +++ b/tests/runtime/common/gc/startGc.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -65,6 +65,10 @@ waitForFinishGC(task_discarded_id); // test mixed GC ref = newWeakRefInCollectibleTenured(); +// Add more garbage objects and trigger concurrent marking +// to add garbage regions into collection set +makeTenuredCollectible(); +waitForFinishGC(startGC("threshold")); gc = startGC("mixed"); waitForFinishGC(gc); assert(ref.deref() === undefined, "Mixed GC didn't collect weak ref");