Answer the question
In order to leave comments, you need to log in
What does the condition mean?
What does the condition mean:
# Simplest test
printf '3\n1 0 0\n0 1 0\n0 0 1\n3\n1\n4\n' >lss_"$SSNN"_in.txt
printf '3\n3.000000000\n1.000000000\n4.000000000\n' >lss_"$SSNN"_out_correct.txt
if ! $LSS &>lss_log.txt
#!/bin/bash
# Linear system solver test script 0 (basic interface test).
# Good for windows/cygwin/bcc32 environment with makefile derived from makefile_00_00.
# In any other environment should work after LSS parameter fixing.
# Defaults
SSNN=19_07
LSS=./lss
LSS_noEX=./lss
# Parsing input parameter
if [ $# -eq 1 ]
then
SSNN=$1
fi
if [ $# -gt 1 ]
then
echo "Usage: lss_test_0.sh [SS_NN]"
exit 1
fi
if ! echo $SSNN | grep '[0-9][0-9]_[0-9][0-9]' >/dev/null
then
echo "Bad parameter format $SSNN ($LINENO)!"
echo "Usage: lss_test_0.sh [SS_NN]"
exit 1
fi
# Checking file presence
function check_file_presence
{
if [ ! -f $1 ]
then
echo "File $1 not found ($LINENO)!"
exit 1
fi
}
check_file_presence main_lss_$SSNN.c
check_file_presence lss_$SSNN.c
check_file_presence lss_$SSNN.h
check_file_presence makefile_lss_$SSNN
# Compiling using user makefile
if ! make -f makefile_lss_$SSNN
then
echo "Error in compilation ($LINENO)!"
exit 1
fi
if [ ! -f $LSS ]
then
if [ ! -f $LSS_noEX ]
then
echo "Warning: linux executable name used, renaming ($LINENO)!"
mv $LSS_noEX $LSS
else
echo "Error: $LSS not found after compilation ($LINENO)!"
exit 1
fi
fi
# Simplest test
printf '3\n1 0 0\n0 1 0\n0 0 1\n3\n1\n4\n' >lss_"$SSNN"_in.txt
printf '3\n3.000000000\n1.000000000\n4.000000000\n' >lss_"$SSNN"_out_correct.txt
if ! $LSS &>lss_log.txt
then
echo "Execution of simplest test failed ($LINENO)!"
exit 1
fi
if [ ! -f lss_"$SSNN"_out.txt ]
then
echo "Output file not found for simplest test ($LINENO)!"
exit 1
fi
if ! diff -b lss_"$SSNN"_out.txt lss_"$SSNN"_out_correct.txt >/dev/null
then
echo "Bad output for simplest test ($LINENO)!"
exit 1
fi
# Checking for parameters support
PARAM_LIST="-d -e -p -t"
for p in $PARAM_LIST
do
rm lss_"$SSNN"_out.txt
if ! $LSS lss_"$SSNN"_in.txt lss_"$SSNN"_out.txt $p &>lss_log.txt
then
echo "Error in execution with parameter $p ($LINENO)!"
exit 1
fi
if [ ! -f lss_"$SSNN"_out.txt ]
then
echo "Output file not found for execution with parameter $p ($LINENO)!"
exit 1
fi
if ! diff -b lss_"$SSNN"_out.txt lss_"$SSNN"_out_correct.txt >/dev/null
then
echo "Bad output for for execution with parameter $p ($LINENO)!"
exit 1
fi
done
BAD_PARAM_LIST="-ZlobniiBuratino --OchenZlobniiBuratino"
for p in $BAD_PARAM_LIST
do
if $LSS lss_"$SSNN"_in.txt lss_"$SSNN"_out.txt $p &>lss_log.txt
then
echo "Launch with bad parameter $p succeed ($LINENO)!"
exit 1
fi
done
# Checking for — compileablilty
gcc main_lss_$SSNN.c lss_$SSNN.c -o lss_bcc>bcc32_compile.txt
if [ $? -ne 0 ]
then
echo "Error in C mode compilation ($LINENO)!"
exit 1
else
rm -rf *.o lss_bcc
fi
echo "Test 0 finished successfully for $SSNN"
exit 0
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question