diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-10-21 15:18:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-10-21 15:18:20 -0300 |
commit | 258355734d3aceb34eb6288ece37d9bbd7f2bc6d (patch) | |
tree | 692b2f43cffa8255f6221704af29fb94c6bbd323 /testes | |
parent | d0815046d003f8f24efcdb03d35dd125ddd3b5f9 (diff) | |
download | lua-258355734d3aceb34eb6288ece37d9bbd7f2bc6d.tar.gz lua-258355734d3aceb34eb6288ece37d9bbd7f2bc6d.tar.bz2 lua-258355734d3aceb34eb6288ece37d9bbd7f2bc6d.zip |
Better support in 'ltests' for tracing the GC
Diffstat (limited to 'testes')
-rw-r--r-- | testes/api.lua | 2 | ||||
-rw-r--r-- | testes/gc.lua | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/testes/api.lua b/testes/api.lua index ae2f82dd..b7e34f7f 100644 --- a/testes/api.lua +++ b/testes/api.lua | |||
@@ -799,7 +799,7 @@ assert(debug.getuservalue(b) == 134) | |||
799 | -- test barrier for uservalues | 799 | -- test barrier for uservalues |
800 | do | 800 | do |
801 | local oldmode = collectgarbage("incremental") | 801 | local oldmode = collectgarbage("incremental") |
802 | T.gcstate("atomic") | 802 | T.gcstate("enteratomic") |
803 | assert(T.gccolor(b) == "black") | 803 | assert(T.gccolor(b) == "black") |
804 | debug.setuservalue(b, {x = 100}) | 804 | debug.setuservalue(b, {x = 100}) |
805 | T.gcstate("pause") -- complete collection | 805 | T.gcstate("pause") -- complete collection |
diff --git a/testes/gc.lua b/testes/gc.lua index 3f8143b1..09bfe09a 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
@@ -560,8 +560,8 @@ if T then -- tests for weird cases collecting upvalues | |||
560 | -- create coroutine in a weak table, so it will never be marked | 560 | -- create coroutine in a weak table, so it will never be marked |
561 | t.co = coroutine.wrap(foo) | 561 | t.co = coroutine.wrap(foo) |
562 | local f = t.co() -- create function to access local 'a' | 562 | local f = t.co() -- create function to access local 'a' |
563 | T.gcstate("atomic") -- ensure all objects are traversed | 563 | T.gcstate("enteratomic") -- ensure all objects are traversed |
564 | assert(T.gcstate() == "atomic") | 564 | assert(T.gcstate() == "enteratomic") |
565 | assert(t.co() == 100) -- resume coroutine, creating new table for 'a' | 565 | assert(t.co() == 100) -- resume coroutine, creating new table for 'a' |
566 | assert(T.gccolor(t.co) == "white") -- thread was not traversed | 566 | assert(T.gccolor(t.co) == "white") -- thread was not traversed |
567 | T.gcstate("pause") -- collect thread, but should mark 'a' before that | 567 | T.gcstate("pause") -- collect thread, but should mark 'a' before that |
@@ -574,7 +574,7 @@ if T then -- tests for weird cases collecting upvalues | |||
574 | collectgarbage() | 574 | collectgarbage() |
575 | collectgarbage"stop" | 575 | collectgarbage"stop" |
576 | local a = {} -- avoid 'u' as first element in 'allgc' | 576 | local a = {} -- avoid 'u' as first element in 'allgc' |
577 | T.gcstate"atomic" | 577 | T.gcstate"enteratomic" |
578 | T.gcstate"sweepallgc" | 578 | T.gcstate"sweepallgc" |
579 | local x = {} | 579 | local x = {} |
580 | assert(T.gccolor(u) == "black") -- userdata is "old" (black) | 580 | assert(T.gccolor(u) == "black") -- userdata is "old" (black) |