diff --git a/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java b/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java index 70fcc3422..c6cb4060d 100644 --- a/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java +++ b/src/test/java/dan200/computercraft/core/computer/ComputerThreadTest.java @@ -85,7 +85,7 @@ public class ComputerThreadTest assertEquals( budget, TimeUnit.MILLISECONDS.toNanos( 25 ), "Budget should be 25ms" ); long delay = ConcurrentHelpers.waitUntil( timeout::isPaused ); - assertThat( "Paused within 25ms", delay * 1e-9, closeTo( 0.03, 0.015 ) ); + assertThat( "Paused within 25ms", delay * 1e-9, closeTo( 0.03, 0.02 ) ); computer.shutdown(); return MachineResult.OK; diff --git a/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt b/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt index 360b933ae..9f34b99c1 100644 --- a/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt +++ b/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt @@ -23,9 +23,11 @@ object Times { * Custom timeouts for various test types. */ object Timeouts { - const val COMPUTER_TIMEOUT: Int = 200 + private const val SECOND: Int = 20 - const val CLIENT_TIMEOUT: Int = 400 + const val COMPUTER_TIMEOUT: Int = SECOND * 15 + + const val CLIENT_TIMEOUT: Int = SECOND * 20 } /** diff --git a/src/testMod/java/dan200/computercraft/ingame/mod/Copier.java b/src/testMod/java/dan200/computercraft/ingame/mod/Copier.java index ba5709fe8..063a142f0 100644 --- a/src/testMod/java/dan200/computercraft/ingame/mod/Copier.java +++ b/src/testMod/java/dan200/computercraft/ingame/mod/Copier.java @@ -6,6 +6,7 @@ package dan200.computercraft.ingame.mod; import com.google.common.io.MoreFiles; +import com.google.common.io.RecursiveDeleteOption; import java.io.IOException; import java.nio.file.FileVisitResult; @@ -55,7 +56,7 @@ public final class Copier extends SimpleFileVisitor public static void replicate( Path from, Path to, Predicate check ) throws IOException { - if( Files.exists( to ) ) MoreFiles.deleteRecursively( to ); + if( Files.exists( to ) ) MoreFiles.deleteRecursively( to, RecursiveDeleteOption.ALLOW_INSECURE ); Files.walkFileTree( from, new Copier( from, to, check ) ); } } diff --git a/src/testMod/server-files/computers/computer/0/startup.lua b/src/testMod/server-files/computers/computer/0/startup.lua index b0b815745..b67ad6af7 100644 --- a/src/testMod/server-files/computers/computer/0/startup.lua +++ b/src/testMod/server-files/computers/computer/0/startup.lua @@ -4,6 +4,14 @@ if label == nil then return test.fail("Label a computer to use it.") end local fn, err = loadfile("tests/" .. label .. ".lua", nil, _ENV) if not fn then return test.fail(err) end +local source = "@" .. label .. ".lua" +debug.sethook(function() + local i = debug.getinfo(2, "lS") + if i.source == source and i.currentline then + test.log("At line " .. i.currentline) + end +end, "l") + local ok, err = pcall(fn) if not ok then return test.fail(err) end