Skip to content

Commit

Permalink
More debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Dec 26, 2024
1 parent fb90a57 commit c2558ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
13 changes: 11 additions & 2 deletions runner/main/modules/docker-jmeter/libraries/recorder.bsf
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ EscapeQuotes(String text) {
return text.replace("'", "\\'");
}

LogString(String logString) {
String logPath = "output/logs/debug.log";
FileWriter fstream = new FileWriter(logPath, true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(logString);
out.close();
}

Runnable mr = MoodleResult(ctx);

// Get the file (it is created in testStarted).
Expand All @@ -159,12 +167,13 @@ FileWriter fstream = new FileWriter(filenamepath, true);
BufferedWriter out = new BufferedWriter(fstream);

// We add the run info when starting the first thread
System.out.println("Checking if header printed");
LogString("Checking if header printed");
if (JMeterUtils.getProperty("headerprinted") == null) {
print("Header not printed - adding it now");
LogString("Header not printed - adding it now");
// Output headers.
JMeterUtils.setProperty("headerprinted", "1");
print(mr.headerToString());
LogString(mr.headerToString());

out.write("$host = '"+vars.get("host")+"';\n");
out.write("$sitepath = '"+vars.get("sitepath")+"';\n");
Expand Down
17 changes: 0 additions & 17 deletions runner/main/modules/docker-jmeter/libraries/recorderfunctions.bsf
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,5 @@ testStarted(){
FileWriter fstream = new FileWriter(filenamepath, true);
BufferedWriter out = new BufferedWriter(fstream);
out.write("<?php\n");

out.write("$host = '"+vars.get("host")+"';\n");
out.write("$sitepath = '"+vars.get("sitepath")+"';\n");
out.write("$group = '"+EscapeQuotes(props.get("group"))+"';\n");
out.write("$rundesc = '"+EscapeQuotes(props.get("desc"))+"';\n");
out.write("$users = '"+vars.get("users")+"';\n");
out.write("$loopcount = '"+vars.get("loops")+"';\n");
out.write("$rampup = '"+vars.get("rampup")+"';\n");
out.write("$throughput = '"+vars.get("throughput")+"';\n");
out.write("$size = '"+vars.get("size")+"';\n");
out.write("$baseversion = '"+vars.get("moodleversion")+"';\n");
out.write("$siteversion = '"+EscapeQuotes(props.get("siteversion"))+"';\n");
out.write("$sitebranch = '"+EscapeQuotes(props.get("sitebranch"))+"';\n");
out.write("$sitecommit = '"+EscapeQuotes(props.get("sitecommit"))+"';\n");

// Send the run timestamp to set it as run filename.
props.put("filepath", "runs/" + vars.get("runtimestamp") + ".php");
out.close();
}

0 comments on commit c2558ce

Please sign in to comment.