diff --git a/kdesrc-build b/kdesrc-build index 6cd7f1d..9320966 100755 --- a/kdesrc-build +++ b/kdesrc-build @@ -6457,7 +6457,8 @@ sub installTemplatedFile unlink($destinationPath); } - next unless $line; # Skip blank lines + # Some lines should only be present in the source as they aid with testing. + next if $line =~ /kdesrc-build: filter/; $line =~ s { diff --git a/kdesrc-build-test.pl b/kdesrc-build-test.pl index 76bad4a..253ae75 100755 --- a/kdesrc-build-test.pl +++ b/kdesrc-build-test.pl @@ -516,9 +516,16 @@ SKIP: { like ($newQMakePossibility, qr/^qmake/, 'qmake looks like an executable even in scalar context.'); } +is(system('/bin/sh', '-n', "$RealBin/sample-xsession.sh"), 0, 'xsession pre-install syntax check'); + +$ENV{KDESRC_BUILD_TESTING} = 1; # Tell sample-xsession.sh not to run. +is(system('/bin/sh', '-u', "$RealBin/sample-xsession.sh"), 0, 'xsession unset variable check'); + # Ensure this function can run without throwing exception. ok(installTemplatedFile("$RealBin/sample-xsession.sh", "$testSourceDirName/xsession.sh", $ctx) || 1, - 'installing-template'); + 'xsession template installation'); + +is(system('/bin/sh', '-n', "$testSourceDirName/xsession.sh"), 0, 'xsession post-install syntax check'); done_testing(); ### TESTS GO ABOVE THIS LINE diff --git a/sample-xsession.sh b/sample-xsession.sh index 936e4c9..ff5ebb6 100644 --- a/sample-xsession.sh +++ b/sample-xsession.sh @@ -14,12 +14,19 @@ # === User-modifiable variables. Should be set automatically by kdesrc-build. +# kdesrc-build: filter | The KDESRC_BUILD_TESTING stuff is to allow the script to +# kdesrc-build: filter | be executable by testsuite. It is filtered from destination. +if ! test -n "$KDESRC_BUILD_TESTING"; then # kdesrc-build: filter # Where KDE libraries and applications are installed to. kde_prefix="<% kdedir %>" # E.g. "$HOME/kde-4" # Where Qt is installed to. If using the system Qt, leave blank or set to # 'auto' and this script will try to auto-detect. qt_prefix="<% qtdir %>" # E.g. "$HOME/qt4" or "/usr" on many systems. +else # kdesrc-build: filter +kde_prefix="$HOME/kde" # kdesrc-build: filter +qt_prefix="$HOME/qt4" # kdesrc-build: filter +fi # kdesrc-build: filter # Directory to use for KDE configuration and other user customizations. KDEHOME="$HOME/.kde4-self" # Or perhaps "$HOME/.kde-selfmade", etc. @@ -67,7 +74,7 @@ fi # Can't use function keyword in Busybox-sh path_add() { - eval curVal=\$'{'$1'}' + eval curVal=\$'{'$1'-}' if [ -n "$curVal" ]; then eval "$1"="$2:$curVal"; @@ -130,6 +137,7 @@ export XDG_CONFIG_DIRS export MANPATH export KDEHOME +if ! test -n "$KDESRC_BUILD_TESTING"; then # kdesrc-build: filter # Read in user-specific customizations if test -f "$HOME/.xsession-local"; then source "$HOME/.xsession-local" @@ -148,3 +156,4 @@ fi if test -f "$HOME/.xsession-logout"; then source "$HOME/.xsession-logout" fi +fi # kdesrc-build: filter