test: Add logging and some intentionally failing cases
We want to log the output of the tests rather than letting them go to stderr. This allows tests we expect to fail to be run.master
parent
8269cbce81
commit
8f9a612990
|
@ -1,2 +1,3 @@
|
||||||
|
*.log
|
||||||
rulescomp
|
rulescomp
|
||||||
xkey
|
xkey
|
||||||
|
|
|
@ -6,6 +6,9 @@ TESTS_ENVIRONMENT = $(SHELL)
|
||||||
check_PROGRAMS = xkey rulescomp
|
check_PROGRAMS = xkey rulescomp
|
||||||
TESTS = xkey.sh rulescomp.sh
|
TESTS = xkey.sh rulescomp.sh
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
rm -f *.log
|
||||||
|
|
||||||
xkey_SOURCES = xkey.c
|
xkey_SOURCES = xkey.c
|
||||||
xkey_LDADD = $(top_builddir)/src/libxkbcommon.la
|
xkey_LDADD = $(top_builddir)/src/libxkbcommon.la
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,30 @@
|
||||||
srcdir=${srcdir-.}
|
srcdir=${srcdir-.}
|
||||||
builddir=${builddir-.}
|
builddir=${builddir-.}
|
||||||
|
|
||||||
|
log="$builddir/rulescomp.log"
|
||||||
|
|
||||||
compile()
|
compile()
|
||||||
{
|
{
|
||||||
${builddir}/rulescomp "$1" "$2" "$3" "$4" "$5" || exit $?
|
echo "${builddir}/rulescomp '$1' '$2' '$3' '$4' '$5'" >>"$log"
|
||||||
|
${builddir}/rulescomp "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1 || exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
failcompile()
|
||||||
|
{
|
||||||
|
echo "${builddir}/rulescomp '$1' '$2' '$3' '$4' '$5'" >>"$log"
|
||||||
|
if ${builddir}/rulescomp "$1" "$2" "$3" "$4" "$5" >>"$log" 2>&1; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
rm -f "$log"
|
||||||
|
|
||||||
compile base pc105 us "" ""
|
compile base pc105 us "" ""
|
||||||
|
compile base "" us "" ""
|
||||||
compile evdev pc105 us intl ""
|
compile evdev pc105 us intl ""
|
||||||
compile evdev pc105 us intl grp:alts_toggle
|
compile evdev pc105 us intl grp:alts_toggle
|
||||||
|
|
||||||
|
failcompile "" "" "" "" "" ""
|
||||||
|
failcompile base "" "" "" "" ""
|
||||||
|
failcompile base pc105 "" "" "" ""
|
||||||
|
failcompile badrules "" us "" "" ""
|
||||||
|
|
12
test/xkey.sh
12
test/xkey.sh
|
@ -3,6 +3,8 @@
|
||||||
srcdir=${srcdir-.}
|
srcdir=${srcdir-.}
|
||||||
builddir=${builddir-.}
|
builddir=${builddir-.}
|
||||||
|
|
||||||
|
log="$builddir/xkey.log"
|
||||||
|
|
||||||
check_error()
|
check_error()
|
||||||
{
|
{
|
||||||
if [ "$2" != "$3" ]; then
|
if [ "$2" != "$3" ]; then
|
||||||
|
@ -15,18 +17,24 @@ check_error()
|
||||||
|
|
||||||
check_string()
|
check_string()
|
||||||
{
|
{
|
||||||
|
echo "${builddir}/xkey -s '$1'" >>"$log"
|
||||||
val=`${builddir}/xkey -s "$1"` &&
|
val=`${builddir}/xkey -s "$1"` &&
|
||||||
check_error "$1" "$2" "$val" ||
|
echo "$val" >>"$log" &&
|
||||||
|
check_error "$1" "$2" "$val" >>"$log" 2>&1 ||
|
||||||
exit $?
|
exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
check_key()
|
check_key()
|
||||||
{
|
{
|
||||||
|
echo "${builddir}/xkey -k '$1'" >>"$log"
|
||||||
val=`${builddir}/xkey -k "$1"` && \
|
val=`${builddir}/xkey -k "$1"` && \
|
||||||
check_error "$1" "$2" "$val" || \
|
echo "$val" >>"$log" &&
|
||||||
|
check_error "$1" "$2" "$val" >>"$log" 2>&1 || \
|
||||||
exit $?
|
exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rm -f "$log"
|
||||||
|
|
||||||
check_string Undo 0xFF65
|
check_string Undo 0xFF65
|
||||||
check_key 0x1008FF56 XF86Close
|
check_key 0x1008FF56 XF86Close
|
||||||
check_string ThisKeyShouldNotExist NoSymbol
|
check_string ThisKeyShouldNotExist NoSymbol
|
||||||
|
|
Loading…
Reference in New Issue