Skip to content

Commit

Permalink
remove settings for unsupported kex features
Browse files Browse the repository at this point in the history
  • Loading branch information
edwin1729 committed Jul 24, 2024
1 parent 237e549 commit b766057
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ import org.jetbrains.research.testspark.settings.kex.KexSettingsState
@State(name = "KexSettingsState", storages = [Storage("KexSettings.xml")])
class KexSettingsService : PersistentStateComponent<KexSettingsState> {
private var kexSettingsState: KexSettingsState = KexSettingsState()

/**
* Gets the currently persisted state of the application.
* This method is called every time the values in the EvoSuite Settings page are saved.
* If the values from getState are different from the default values obtained by calling
* the default constructor, the state is persisted (serialised and stored).
*/
override fun getState(): KexSettingsState {
return kexSettingsState
}

/**
* Loads the state of the application-level settings.
* This method is called after the application-level settings component has been created
* and if the XML file with the state is changes externally.
*/
override fun loadState(state: KexSettingsState) {
kexSettingsState = state
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class KexSettingsComponent : SettingsComponent {
private var kexPathTextField = JTextField()
private var kexModeSelector = ComboBox(KexMode.entries.toTypedArray())
private var optionTextField = JTextField() //TODO comments for these
private var crashDepthTextField = JTextField()
private var crashTraceTextField = JTextField()
private var libraryTargetTextField = JTextField()

var kexPath: String
get() = kexPathTextField.text
Expand All @@ -42,22 +39,6 @@ class KexSettingsComponent : SettingsComponent {
optionTextField.text = x
}

var crashDepth: String
get() = crashDepthTextField.text
set(x) {
crashDepthTextField.text = x
}
var crashTrace: String
get() = crashTraceTextField.text
set(x) {
crashTraceTextField.text = x
}
var libraryTarget: String
get() = libraryTargetTextField.text
set(x) {
libraryTargetTextField.text = x
}

init {
super.initComponent()
}
Expand All @@ -71,9 +52,6 @@ class KexSettingsComponent : SettingsComponent {
.addLabeledComponent(JBLabel(KexLabelsBundle.get("kexHome")), kexPathTextField, 10, false)
.addLabeledComponent(JBLabel(KexLabelsBundle.get("kexMode")), kexModeSelector, 10, false)
.addLabeledComponent(JBLabel(KexLabelsBundle.get("option")), optionTextField, 10, false)
.addLabeledComponent(JBLabel(KexLabelsBundle.get("crashDepth")), crashDepthTextField, 10, false)
.addLabeledComponent(JBLabel(KexLabelsBundle.get("crashTrace")), crashTraceTextField, 10, false)
.addLabeledComponent(JBLabel(KexLabelsBundle.get("libraryTarget")), libraryTargetTextField, 10, false)
.panel
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ class KexSettingsConfigurable(private val project: Project) : SettingsConfigurab
settingsComponent!!.kexPath = kexSettingsState.kexHome
settingsComponent!!.kexMode = kexSettingsState.kexMode
settingsComponent!!.option = kexSettingsState.option
settingsComponent!!.crashDepth = kexSettingsState.crashDepth
settingsComponent!!.crashTrace = kexSettingsState.crashTrace
settingsComponent!!.libraryTarget = kexSettingsState.libraryTarget
}

/**
Expand All @@ -42,9 +39,6 @@ class KexSettingsConfigurable(private val project: Project) : SettingsConfigurab
return settingsComponent!!.kexPath != kexSettingsState.kexHome
|| settingsComponent!!.kexMode != kexSettingsState.kexMode
|| settingsComponent!!.option != kexSettingsState.option
|| settingsComponent!!.crashDepth != kexSettingsState.crashDepth
|| settingsComponent!!.crashTrace != kexSettingsState.crashTrace
|| settingsComponent!!.libraryTarget != kexSettingsState.libraryTarget
}

/**
Expand All @@ -54,9 +48,6 @@ class KexSettingsConfigurable(private val project: Project) : SettingsConfigurab
kexSettingsState.kexHome = settingsComponent!!.kexPath
kexSettingsState.kexMode = settingsComponent!!.kexMode
kexSettingsState.option = settingsComponent!!.option
kexSettingsState.crashDepth = settingsComponent!!.crashDepth
kexSettingsState.crashTrace = settingsComponent!!.crashTrace
kexSettingsState.libraryTarget = settingsComponent!!.libraryTarget
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ data class KexSettingsState(
var kexHome: String = DefaultKexSettingsState.kexHome,
var kexMode: KexMode = DefaultKexSettingsState.kexMode,
var option: String = DefaultKexSettingsState.option,
var crashDepth: String = DefaultKexSettingsState.crashDepth,
var crashTrace: String = DefaultKexSettingsState.crashTrace,
var libraryTarget: String = DefaultKexSettingsState.libraryTarget,
) {

/**
Expand All @@ -24,8 +21,5 @@ data class KexSettingsState(
var kexHome: String = KexDefaultsBundle.get("kexHome")
var kexMode: KexMode = KexMode.Concolic
var option: String = KexDefaultsBundle.get("option")
var crashDepth: String = KexDefaultsBundle.get("crashDepth")
var crashTrace: String = KexDefaultsBundle.get("crashTrace")
var libraryTarget: String = KexDefaultsBundle.get("libraryTarget")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ class KexSettingsArguments {
cmd.add("--option")
cmd.add(kexSettingsState.option)
}
if (kexSettingsState.crashDepth.isNotBlank()) {
cmd.add("--depth")
cmd.add(kexSettingsState.crashDepth)
}
if (kexSettingsState.crashTrace.isNotBlank()) {
cmd.add("--trace")
cmd.add(kexSettingsState.crashTrace)
}
if (kexSettingsState.libraryTarget.isNotBlank()) {
cmd.add("--libraryTarget")
cmd.add(kexSettingsState.libraryTarget)
}
return cmd
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,24 @@ class KexProcessManager(
val cmdString = cmd.fold(String()) { acc, e -> acc.plus(e).plus(" ") }
log.info("Starting Kex with arguments: $cmdString")

// try {
// val pb = ProcessBuilder(cmd)
// .directory(File(kexHome))
// .redirectOutput(ProcessBuilder.Redirect.PIPE)
// .redirectError(ProcessBuilder.Redirect.PIPE)
//
// pb.environment()["KEX_HOME"] = kexHome
// val proc = pb.start()
// proc.waitFor(kexProcessTimeout, TimeUnit.SECONDS)
// val kexOutStr = proc.inputStream.bufferedReader().readText()
//
//
// log.info("OUTPUT FROM KEX:\n $kexOutStr")
// System.err.println("PRINTING from STDERR:\n $kexOutStr")
//
// } catch (e: IOException) {
// e.printStackTrace()
// }
try {
val pb = ProcessBuilder(cmd)
.directory(File(kexHome))
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)

pb.environment()["KEX_HOME"] = kexHome
val proc = pb.start()
proc.waitFor(kexProcessTimeout, TimeUnit.SECONDS)
val kexOutStr = proc.inputStream.bufferedReader().readText()


log.info("OUTPUT FROM KEX:\n $kexOutStr")
System.err.println("PRINTING from STDERR:\n $kexOutStr")

} catch (e: IOException) {
e.printStackTrace()
}

log.info("Save generated test suite and test cases into the project workspace")
val report = IJReport()
Expand Down
5 changes: 1 addition & 4 deletions src/main/resources/properties/kex/KexDefaults.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
kexVersion=0.0.8
kexHome=/homes/ef322/kex
option=
crashDepth=
crashTrace=
libraryTarget=
option=
7 changes: 2 additions & 5 deletions src/main/resources/properties/kex/KexLabels.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
kexHome=Provide path to directory where kex should be downloaded
kexSettings=Kex Settings
kexMode=kex mode
option=set kex option through command line <section:name:value>
crashDepth=depth with which to analyze the crash, required for the crash mode
crashTrace=path to a trace file with a crash, required for the crash mode
libraryTarget=package where to analyze library usages, required for the libchecker mode
kexMode=Kex mode
option=Kex Options (format:- <section:name:value>)

0 comments on commit b766057

Please sign in to comment.