mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-09 15:19:11 +02:00
Add env var tests
This commit is contained in:
parent
1a8912c9c2
commit
89a4c5d609
3 changed files with 36 additions and 0 deletions
|
|
@ -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')
|
||||
|
|
|
|||
33
test/environment-variables
Normal file
33
test/environment-variables
Normal 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}"
|
||||
|
||||
|
||||
|
||||
2
test/testing-configurations/env-var-config
Normal file
2
test/testing-configurations/env-var-config
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
exec (echo "SUCCESS" > CONFIGPATH )
|
||||
quit
|
||||
Loading…
Add table
Add a link
Reference in a new issue