Scripts for more automatic app battery testing

Jiri Dluhos <[email protected]>
Newsgroups gmane.linux.lsb.test-suite
Message-ID <[email protected]>
Hello,

When doing the standard LSB App Battery tests, I have tried to write some 
primitive shell scripts to do part of the repetitive work. (Please find the 
attached ones; I will possibly try to write some more)

Do you think it would be good to have such scripts as an example on the App 
Battery test suite web site? This way, any LSB tester could download them, 
adapt them a bit to local machines and hopefully make his/her life a bit 
easier :-)

Thanks for opinions,

Best regards,

    Jiri Dluhos

_______________________________________________
lsb-test mailing list
[email protected]
http://mail.freestandards.org/mailman/listinfo/lsb-test
lsb-expect-test.sh (application/x-shellscript, 1.1 KB)
#!/bin/sh
#
# Automated test for lsb-expect.

EXPECT=/opt/lsb/appbat/bin/expect
TMPDIR=/tmp/lsb-expect-test
TESTFILE=expect-tests.tar

echo -n "Looking if" $EXPECT "is installed... "
if [ -e $EXPECT ] ; then
    echo "OK" ;
else
    echo "FAILED"
    exit 1 ;
fi

echo -n "Checking package version... "
if ! rpm -q "lsb-expect" ; then
    echo "FAILED"
    exit 1 ;
fi

# Check if we have the test suite archive.
if ! [ -e $TESTFILE ] ; then
    echo "Could not find the test suite archive" $TESTFILE
    exit 1 ;
fi

# Create a temporary directory, copy the test suite archive and enter it.
if ! mkdir -p $TMPDIR ; then
    echo "Could not create temporary directory" $TMPDIR
    exit 1 ;
fi
cp $TESTFILE $TMPDIR
pushd $TMPDIR >/dev/null

# Unpack the test suite files to the temporary directory.
echo -n "Unpacking test suite files... "
if ! tar xvf $TESTFILE >/dev/null ; then
    echo "FAILED"
    exit 1 ;
fi
echo "OK"

# Run the tests.
echo "Running the test suite. Please wait."
$EXPECT all.tcl > results.txt

# Return back to the original directory.
popd >/dev/null

# All done.
echo "Done; results are in" $TMPDIR/results.txt
lsb-tcl-test.sh (application/x-shellscript, 1.1 KB)
#!/bin/sh
#
# Automated test for lsb-tcl.

TCL=/opt/lsb/appbat/bin/tclsh8.4
TESTFILE=tcl8.4.11-tests.tar
TMPDIR=/tmp/lsb-tcl-test

echo -n "Looking if lsb-tcl is installed... "
if [ -e $TCL ] ; then
    echo "OK" ;
else
    echo "FAILED"
    exit 1 ;
fi

echo -n "Checking lsb-tcl package version... "
if ! rpm -q "lsb-tcl" ; then
    echo "FAILED"
    exit 1 ;
fi

# Check if we have the test suite archive.
if ! [ -e $TESTFILE ] ; then
    echo "Could not find the test suite archive" $TESTFILE
    exit 1 ;
fi

# Create a temporary directory, copy the test suite archive and enter it.
if ! mkdir -p $TMPDIR ; then
    echo "Could not create temporary directory" $TMPDIR
    exit 1 ;
fi
cp $TESTFILE $TMPDIR
pushd $TMPDIR >/dev/null

# Unpack the test suite files to the temporary directory.
echo -n "Unpacking test suite files... "
if ! tar xvf $TESTFILE >/dev/null ; then
    echo "FAILED"
    exit 1 ;
fi
echo "OK"

# Run the tests.
echo "Running the test suite. Please wait."
$TCL all.tcl > results.txt

# Return back to the original directory.
popd >/dev/null

# All done.
echo "Done; results are in" $TMPDIR/results.txt
lsb-groff-test.sh (application/x-shellscript, 1.5 KB)
#!/bin/sh
#
# Automated test for lsb-groff.

GROFF=/opt/lsb/appbat/bin/groff
MANDIR=/opt/lsb/appbat/man
TMPDIR=/tmp/lsb-groff-test

echo -n "Looking if lsb-groff is installed... "
if [ -e $GROFF ] ; then
    echo "OK" ;
else
    echo "FAILED"
    exit 1 ;
fi

echo -n "Checking lsb-groff package version... "
if ! rpm -q "lsb-groff" ; then
    echo "FAILED"
    exit 1 ;
fi

# Create a temporary directory and move into it.
if ! mkdir -p $TMPDIR ; then
    echo "Could not create temporary directory" $TMPDIR
    exit 1 ;
fi
pushd $TMPDIR >/dev/null

echo -n "Getting groff version info... "
if $GROFF -v >groff_version.txt ; then
    echo "OK" ;
else
    echo "FAILED"
    exit 1 ;
fi

echo -n "Transforming manual page to PostScript... "
if $GROFF -mandoc $MANDIR/man1/groff.1 >groff_man.ps ; then
    echo "OK (written to groff_man.ps)" ;
else
    echo "FAILED" ;
fi

echo -n "Transforming manual page to ASCII... "
if $GROFF -mandoc -Tascii $MANDIR/man1/nroff.1 >nroff_man.txt ; then
    echo "OK (written to nroff_man.txt)" ;
else
    echo "FAILED" ;
fi

echo -n "Transforming manual page to Latin-1... "
if $GROFF -mandoc -Tlatin1 $MANDIR/man1/troff.1 >troff_man.txt ; then
    echo "OK (written to troff_man.txt)" ;
else
    echo "FAILED" ;
fi

echo -n "Transforming manual page to HTML... "
if $GROFF -mandoc -Thtml $MANDIR/man1/eqn.1 >eqn_man.html ; then
    echo "OK (written to eqn_man.html)" ;
else
    echo "FAILED" ;
fi

# Return back to the original directory.
popd >/dev/null

# All done.
echo "Done; results are in" $TMPDIR
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.