Skip to content

Instantly share code, notes, and snippets.

@sblack4
Last active May 4, 2021 17:02
Show Gist options
  • Save sblack4/f997708346adf0d5fa50ea3e13d2ad4c to your computer and use it in GitHub Desktop.
Save sblack4/f997708346adf0d5fa50ea3e13d2ad4c to your computer and use it in GitHub Desktop.
Run Jmeter for dev and test then tar it all up
#!/bin/bash
run_datetime=`date +%F_%H-%M-%S`
test_artifacts_name="${run_datetime}/TEST"
dev_artifacts_name="${run_datetime}/DEV"
run() {
rm -rf 2021-*
mkdir -p $test_artifacts_name $dev_artifacts_name
bin/jmeter -n -t sbdtest.jmx -l "${test_artifacts_name}.txt" -e -o $test_artifacts_name
bin/jmeter -n -t sbddev.jmx -l "${dev_artifacts_name}.txt" -e -o $dev_artifacts_name
}
export() {
tar zfc "${run_datetime}.tar.gz" $run_datetime
cp "${run_datetime}.tar.gz" /tmp
chown steven.black:steven.black "/tmp/${run_datetime}.tar.gz"
echo "artifacts in:"
echo " /tmp/${run_datetime}.tar.gz"
}
compute() {
python2 - << EOF
import json
testfile = ""
devfile = ""
with open("$test_artifacts_name/statistics.json") as jf:
testfile = json.load(jf)
with open("$dev_artifacts_name/statistics.json") as jf:
devfile = json.load(jf)
print "test $run_datetime, dev_time, test_time, test_time - dev_time"
for test, dev in zip(testfile, devfile):
testtime = testfile[test].get('meanResTime', 0)
devtime = devfile[dev].get('meanResTime', 0)
print "%s, %s, %s, %s" % (test, devtime, testtime, (testtime - devtime))
EOF
}
main() {
run
export
compute
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment