Add env var tests

This commit is contained in:
project-repo 2023-02-14 20:22:31 +01:00
commit 89a4c5d609
3 changed files with 36 additions and 0 deletions

View file

@ -315,3 +315,4 @@ test('Build without xwayland', find_program('test/build-w-o-xwayland'), env : [
test('Clang-format formatting check', find_program('test/clang-format'), args : [ cagebreak_main_file + cagebreak_source_strings + cagebreak_header_strings ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic')
test('Arguments', find_program('test/arguments'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic')
test('Scan-build static analysis', find_program('test/scan-build'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release')
test('Environment Variables', find_program('test/environment-variables'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic')

View file

@ -0,0 +1,33 @@
#!/bin/bash
testdir=$(mktemp -d)
mkdir "${testdir}/cagebreak"
RESULT=0
# CAGEBREAK_SOCKET (duplicate of arguments test)
## Check without socket
cp $MESONCURRENTCONFIGDIR/test/testing-configurations/config $testdir
readonly oldsocket=$CAGEBREAK_SOCKET
sed -i "s|CONFIGPATH|$testdir\/socket|g" $testdir/config
$(WLR_BACKENDS=headless ./cagebreak -c $testdir/config)
[[ $(cat $testdir/socket) = $oldsocket ]] || RESULT=1
## Check with socket
cp $MESONCURRENTCONFIGDIR/test/testing-configurations/config $testdir
sed -i "s|CONFIGPATH|$testdir\/socket|g" $testdir/config
$(WLR_BACKENDS=headless ./cagebreak -e -c $testdir/config)
[[ ! $(cat $testdir/socket) = $oldsocket ]] || RESULT=1
# XDG_CONFIG_HOME
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/env-var-config" "${testdir}/cagebreak/config"
sed -i "s|CONFIGPATH|${testdir}\/result|g" "${testdir}/cagebreak/config"
XDG_CONFIG_HOME="${testdir}/" WLR_BACKENDS=headless ./cagebreak
[[ $(cat "${testdir}/result") = "SUCCESS" ]] || RESULT=1
# The XKB_DEFAULT_* family of variables is not found in the source code
# of Cagebreak but necessary to configure software for use with Cagebreak.
exit "${RESULT}"

View file

@ -0,0 +1,2 @@
exec (echo "SUCCESS" > CONFIGPATH )
quit