max_drop = os.environ.get('MAX_DROP')
lyx_window_name = os.environ.get('LYX_WINDOW_NAME')
screenshot_out = os.environ.get('SCREENSHOT_OUT')
+lyx_userdir = os.environ.get('LYX_USERDIR')
max_loops = os.environ.get('MAX_LOOPS')
if max_loops is None:
os.system("killall lyx")
time.sleep(0.2)
print "Starting LyX . . ."
- os.system(lyx_exe + c[9:] + "&")
+ if lyx_userdir is None:
+ os.system(lyx_exe + c[9:] + "&")
+ else:
+ os.system(lyx_exe + " -userdir " + lyx_userdir + " " + c[9:] + "&")
while True:
lyx_pid=os.popen("pidof lyx").read().rstrip()
- lyx_window_name=os.popen("wmctrl -l | grep 'lyx$\\|LyX:' | sed -e 's/.*\\([Ll]y[Xx].*\\)$/\\1/'").read().rstrip()
+ lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) + " ' | cut -d ' ' -f 1").read().rstrip()
if lyx_window_name != "":
break
print 'lyx_win: ' + lyx_window_name + '\n'
export LYX_EXE=../../../src/lyx
export KEYTEST=../keytest.py
+export LYX_USERDIR=$(pwd)/home/.lyx
if [ "$#" -eq 0 ]; then
- TESTS=$(ls *-in.txt);
+ TESTS=$(ls *-in.txt | sed -e 's/hello-world-in.txt\|first-time-in.txt//');
else
TESTS=$*
fi
echo
+
+if [ ! -d home ]; then
+ mkdir home
+ cd home
+ echo "Initializing testing environment . . ."
+ if ! ../single-test.sh "../first-time-in.txt" > keytest-log.txt 2>&1; then
+ echo "Some error occurred: check $(pwd)"
+ exit -1;
+ fi
+ cd ..
+fi
+
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"
+ exit -1;
+ fi
rm -rf "out-$t"
mkdir "out-$t"
cd "out-$t"
- printf "%40s: " $t
if ../single-test.sh "../$t-in.txt" > keytest-log.txt 2>&1; then
echo Ok
cd ..