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"
fi
results+=("<tr><td>${CURR_TEST_NAME}</td> results+=("<tr><td>${CURR_TEST_NAME}</td>
<td class='scriptdetails'>${testcommand}</td> <td class='scriptdetails'>${testcommand}</td>
<td class='${TEXTCLASS}'>${TDTEXT}</td> <td class='success'>Success</td>
<td>${execution}</td> <td>${execution}</td>
<td><a href=\"${URL2}/${NAME}.txt\" target=\"_blank\">STDOUT</a></td> <td><a href=\"${URL2}/${NAME}.txt\" target=\"_blank\">STDOUT</a></td>
<td>${STDERR}</td></tr>") <td></td></tr>")
fi
} }
function start_tests() { function start_tests() {
@@ -562,41 +557,43 @@ 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>
.success {
background-color:green; background-color:green;
} }
.failure { .failure {
background-color:red; background-color:red;
} }
.partial_failure { .partial_failure {
background-color:yellow; background-color:yellow;
} }
table { table {
border: 1px solid gray; border: 1px solid gray;
} }
td { td {
margin: 0; margin: 0;
padding: 2px; padding: 2px;
font-family: 'Courier New',courier,sans-serif; font-family: 'Courier New',courier,sans-serif;
} }
h1, h2, h3, h4 { h1, h2, h3, h4 {
font-family: 'Century Gothic',Arial,sans,sans-serif; font-family: 'Century Gothic',Arial,sans,sans-serif;
} }
.scriptdetails { .scriptdetails {
font-size: 10px; font-size: 10px;
} }
</style> </style>
<script src=\"sortabletable.js\"></script> <script src=\"sortabletable.js\"></script>
</head> </head>
<body> <body>
<h1>Regression Results</h1> <h1>Regression Results</h1>
<h4>$NOW</h4> <h4>$NOW</h4>
<h4>$LAST_COMMIT</h4> <h4>$LAST_COMMIT</h4>
<table border ='1' id='myTable2'> <table border ='1' id='myTable2'>
<thead>
<tr> <tr>
<th onclick=\"sortTable('myTable2', 0)\">Command Name</th> <th onclick=\"sortTable('myTable2', 0)\">Command Name</th>
<th onclick=\"sortTable('myTable2', 1)\">Command</th> <th onclick=\"sortTable('myTable2', 1)\">Command</th>
@@ -604,9 +601,10 @@ function html_generator() {
<th onclick=\"sortTable('myTable2', 3)\">Execution time</th> <th onclick=\"sortTable('myTable2', 3)\">Execution time</th>
<th onclick=\"sortTable('myTable2', 4)\">STDOUT</th> <th onclick=\"sortTable('myTable2', 4)\">STDOUT</th>
<th onclick=\"sortTable('myTable2', 5)\">STDERR</th> <th onclick=\"sortTable('myTable2', 5)\">STDERR</th>
</tr>" </tr>
tail="</body> </thead>
</html>" <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"