regression_test.sh: WIP making html styles more enjoyable

Signed-off-by: Jed Reynolds <jed@bitratchet.com>
This commit is contained in:
Jed Reynolds
2021-11-29 14:00:17 -08:00
parent ac936583da
commit cd397ec883

View File

@@ -20,12 +20,7 @@ Help()
echo "If using the help flag, put the H flag at the end of the command after other flags." echo "If using the help flag, put the H flag at the end of the command after other flags."
} }
if [ -d "/home/lanforge/lanforge_env" ]; if [ -d "/home/lanforge/lanforge_env"] && pip3 install --upgrade lanforge-scripts || pip3 install --user -r ../requirements.txt --upgrade
then
pip3 install --upgrade lanforge-scripts
else
pip3 install --user -r ../requirements.txt --upgrade
fi
while getopts ":h:s:S:p:w:m:A:r:F:B:U:D:H:" option; do while getopts ":h:s:S:p:w:m:A:r:F:B:U:D:H:" option; do
case "${option}" in case "${option}" in
@@ -529,13 +524,13 @@ function test() {
STDERR="<a href=\"${URL2}/${NAME}_stderr.txt\" target=\"_blank\">STDERR</a>" STDERR="<a href=\"${URL2}/${NAME}_stderr.txt\" target=\"_blank\">STDERR</a>"
else else
echo "No errors detected" echo "No errors detected"
results+=("<tr><td>${CURR_TEST_NAME}</td>
<td class='scriptdetails'>${testcommand}</td>
<td class='success'>Success</td>
<td>${execution}</td>
<td><a href=\"${URL2}/${NAME}.txt\" target=\"_blank\">STDOUT</a></td>
<td></td></tr>")
fi fi
results+=("<tr><td>${CURR_TEST_NAME}</td>
<td class='scriptdetails'>${testcommand}</td>
<td class='${TEXTCLASS}'>${TDTEXT}</td>
<td>${execution}</td>
<td><a href=\"${URL2}/${NAME}.txt\" target=\"_blank\">STDOUT</a></td>
<td>${STDERR}</td></tr>")
} }
function start_tests() { function start_tests() {
@@ -562,51 +557,54 @@ function start_tests() {
function html_generator() { function html_generator() {
LAST_COMMIT=$(git log --pretty=oneline | head -n 1) LAST_COMMIT=$(git log --pretty=oneline | head -n 1)
header="<html> header="<!DOCTYPE html>
<head> <html>
<title>Regression Test Results $NOW</title> <head>
<style> <title>Regression Test Results $NOW</title>
.success { <style>
background-color:green; .success {
} background-color:green;
.failure { }
background-color:red; .failure {
} background-color:red;
.partial_failure { }
background-color:yellow; .partial_failure {
} background-color:yellow;
table { }
border: 1px solid gray; table {
} border: 1px solid gray;
td { }
margin: 0; td {
padding: 2px; margin: 0;
font-family: 'Courier New',courier,sans-serif; padding: 2px;
} font-family: 'Courier New',courier,sans-serif;
h1, h2, h3, h4 { }
font-family: 'Century Gothic',Arial,sans,sans-serif; h1, h2, h3, h4 {
} font-family: 'Century Gothic',Arial,sans,sans-serif;
.scriptdetails { }
font-size: 10px; .scriptdetails {
} font-size: 10px;
</style> }
<script src=\"sortabletable.js\"></script> </style>
</head> <script src=\"sortabletable.js\"></script>
<body> </head>
<h1>Regression Results</h1> <body>
<h4>$NOW</h4> <h1>Regression Results</h1>
<h4>$LAST_COMMIT</h4> <h4>$NOW</h4>
<table border ='1' id='myTable2'> <h4>$LAST_COMMIT</h4>
<tr> <table border ='1' id='myTable2'>
<th onclick=\"sortTable('myTable2', 0)\">Command Name</th> <thead>
<th onclick=\"sortTable('myTable2', 1)\">Command</th> <tr>
<th onclick=\"sortTable('myTable2', 2)\">Status</th> <th onclick=\"sortTable('myTable2', 0)\">Command Name</th>
<th onclick=\"sortTable('myTable2', 3)\">Execution time</th> <th onclick=\"sortTable('myTable2', 1)\">Command</th>
<th onclick=\"sortTable('myTable2', 4)\">STDOUT</th> <th onclick=\"sortTable('myTable2', 2)\">Status</th>
<th onclick=\"sortTable('myTable2', 5)\">STDERR</th> <th onclick=\"sortTable('myTable2', 3)\">Execution time</th>
</tr>" <th onclick=\"sortTable('myTable2', 4)\">STDOUT</th>
tail="</body> <th onclick=\"sortTable('myTable2', 5)\">STDERR</th>
</html>" </tr>
</thead>
<tbody>"
tail="</body></html>"
fname="${HOMEPATH}/html-reports/regression_file-${NOW}.html" fname="${HOMEPATH}/html-reports/regression_file-${NOW}.html"
echo "$header" >> "$fname" echo "$header" >> "$fname"