Skip to content

Commit 851ce6e

Browse files
committed
Replace disableSandbox with useSandbox in UtSettings
Although `disableSandbox` is a descriptive name, the inverted logic makes it harder to use and does not match the naming of other settings. This commit replaces `disableSandbox` with `useSandbox` and correspondingly modifies necessary checks.
1 parent 64d1bd3 commit 851ce6e

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/UtSettings.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,15 @@ object UtSettings : AbstractSettings(
374374
var ignoreStaticsFromTrustedLibraries by getBooleanProperty(true)
375375

376376
/**
377-
* Disable sandbox in the concrete executor. All unsafe/dangerous calls will be permitted.
377+
* Use the sandbox in the concrete executor.
378+
*
379+
* If true (default), the sandbox will prevent potentially dangerous calls, e.g., file access, reading
380+
* or modifying the environment, calls to `Unsafe` methods etc.
381+
*
382+
* If false, all these operations will be enabled and may lead to data loss during code analysis
383+
* and test generation.
378384
*/
379-
var disableSandbox by getBooleanProperty(false)
380-
385+
var useSandbox by getBooleanProperty(true)
381386
}
382387

383388
/**

utbot-framework-api/src/main/kotlin/org/utbot/testcheckers/SettingsModificators.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ inline fun <reified T> withoutConcrete(block: () -> T): T {
113113
* Run [block] with disabled sandbox in the concrete executor
114114
*/
115115
inline fun <reified T> withoutSandbox(block: () -> T): T {
116-
val prev = UtSettings.disableSandbox
117-
UtSettings.disableSandbox = true
116+
val prev = UtSettings.useSandbox
117+
UtSettings.useSandbox = false
118118
try {
119119
return block()
120120
} finally {
121-
UtSettings.disableSandbox = prev
121+
UtSettings.useSandbox = prev
122122
}
123123
}

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/ChildProcessRunner.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ChildProcessRunner {
5151
val directory = WorkingDirService.provide().toFile()
5252
val commandsWithOptions = buildList {
5353
addAll(cmds)
54-
if (UtSettings.disableSandbox) {
54+
if (!UtSettings.useSandbox) {
5555
add(DISABLE_SANDBOX_OPTION)
5656
}
5757
add(portArgument)

0 commit comments

Comments
 (0)