mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Added the possibility to build arbitrary scripts (*-in.sh) as tests. They are all launched
together with the others when typing 'make', and also they can be selectively launched by using: ./run-tests.sh filename-in.sh. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39241 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
063cf547e2
commit
bf5f1eb3e8
@ -58,6 +58,19 @@ Each test-case script should be named as xxx-in.txt. The syntax of the
|
||||
script is described in detail in the sample test-case script
|
||||
hello-world-in.txt.
|
||||
|
||||
Alternatively, a test-case can be an arbitrary executable script with
|
||||
name ending in "-in.sh", that is launched inside a dedicated folder,
|
||||
and to which the variables LYX_ROOT and LYX_EXE are exported, so that
|
||||
you can easily reference the root LyX sources folder and the program
|
||||
executable. The test script needs to complete with a no-error return
|
||||
value (zero), otherwise a failure is reported (see export-in.sh for
|
||||
an example).
|
||||
|
||||
Whenever LyX is launched, in both cases, the LYX_USERDIR variable is
|
||||
set to autotests/out-home, in order to rely on clean preferences
|
||||
settings (use make clean or make without arguments in order to let
|
||||
that folder be created again).
|
||||
|
||||
|
||||
TODO
|
||||
----------------------------------------------------------------------
|
||||
|
21
development/autotests/export-in.sh
Executable file
21
development/autotests/export-in.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
failed=0
|
||||
for format in xhtml lyx16x; do
|
||||
for f in $LYX_ROOT/lib/doc/*lyx; do
|
||||
if $LYX_EXE -e $format $f >> lyx-log.txt 2>&1; then
|
||||
echo $format $f TEST_GOOD
|
||||
else
|
||||
echo $format $f TEST_BAD
|
||||
failed=$[$failed+1];
|
||||
fi;
|
||||
done;
|
||||
done
|
||||
|
||||
if [ $failed -eq 0 ]; then
|
||||
echo "All formats SUCCESSFUL"
|
||||
exit 0;
|
||||
else
|
||||
echo "There were $failed FAILED format tests"
|
||||
exit -1;
|
||||
fi
|
@ -4,7 +4,8 @@
|
||||
# Tests are identified as having a file name of *-in.txt
|
||||
# For failed tests, the collected output is kept in the corresponding folder
|
||||
|
||||
export LYX_EXE=../../../src/lyx
|
||||
export LYX_ROOT=../../..
|
||||
export LYX_EXE=$LYX_ROOT/src/lyx
|
||||
|
||||
if [ "$XVKBD_HACKED" != "" ]; then
|
||||
export XVKBD_EXE=${XVKBD:-./xvkbd/xvkbd};
|
||||
@ -38,7 +39,7 @@ if [ ! -d ../../locale ]; then
|
||||
fi
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
TESTS=$(ls *-in.txt | sed -e 's/hello-world-in.txt\|first-time-in.txt//')
|
||||
TESTS=$(ls *-in.txt *-in.sh | sed -e 's/hello-world-in.txt\|first-time-in.txt//')
|
||||
rm -rf out-*;
|
||||
else
|
||||
TESTS=$*
|
||||
@ -52,7 +53,7 @@ if [ ! -d $LYX_HOME ]; then
|
||||
# cp preferences $LYX_USERDIR
|
||||
cd $LYX_HOME
|
||||
echo "Initializing testing environment . . ."
|
||||
if ! ../single-test.sh "../first-time-in.txt" > keytest-log.txt 2>&1; then
|
||||
if ! ../single-test.sh "../first-time-in.txt" > test-log.txt 2>&1; then
|
||||
echo "Some error occurred: check $(pwd)"
|
||||
exit -1;
|
||||
fi
|
||||
@ -63,18 +64,34 @@ fi
|
||||
./stop_autotests.tcl &
|
||||
pid=$!
|
||||
|
||||
function stop_button() {
|
||||
kill $pid
|
||||
wait $pid > /dev/null 2>&1
|
||||
}
|
||||
|
||||
echo "Running test cases . . ."
|
||||
failed=0
|
||||
for t in $(echo "$TESTS" | sed -e 's/-in.txt//g'); do
|
||||
printf "%40s: " $t
|
||||
if [ ! -f "$t-in.txt" ]; then
|
||||
echo "ERROR: File not found: $t-in.txt"
|
||||
for tf in $(echo "$TESTS"); do
|
||||
t=$(echo $tf | sed -e 's/-in.txt//g' | sed -e 's/-in.sh//g')
|
||||
printf "%40s: " $tf
|
||||
if [ -f "$t-in.txt" ]; then
|
||||
cmd="../single-test.sh ../$t-in.txt";
|
||||
elif [ -f "$t-in.sh" ]; then
|
||||
if [ ! -x "$t-in.sh" ]; then
|
||||
echo "ERROR: $t-in.sh is not executable"
|
||||
stop_button
|
||||
exit -1;
|
||||
fi
|
||||
cmd="../$tf";
|
||||
else
|
||||
echo "ERROR: File not found: $t-in.txt or $t-in.sh"
|
||||
stop_button
|
||||
exit -1;
|
||||
fi
|
||||
rm -rf "out-$t"
|
||||
mkdir "out-$t"
|
||||
cd "out-$t"
|
||||
if ../single-test.sh "../$t-in.txt" > keytest-log.txt 2>&1; then
|
||||
if "$cmd" > test-log.txt 2>&1; then
|
||||
echo Ok
|
||||
cd ..
|
||||
rm -rf "out-$t";
|
||||
@ -85,8 +102,7 @@ for t in $(echo "$TESTS" | sed -e 's/-in.txt//g'); do
|
||||
fi;
|
||||
done
|
||||
|
||||
kill $pid
|
||||
wait $pid > /dev/null 2>&1
|
||||
stop_button
|
||||
|
||||
echo
|
||||
if [ $failed -eq 0 ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user