cagebreak/test/environment-variables
project-repo 4f7be9d5cd Release 2.1.0
- Add -bs (bad security) option
- Fix Issue 57 (SPDX spelling error #39)
- Fix Issue 59 (meson install settings)
- Fix Issue 55 (npd)
- Fix Issue 56 (npd)
- Fix Issue 58 (#40 config)
- Improve release procedure
- Add miniscule test suite
- Adjust Cagebreak to wlroots 0.16.2
- New GPG Keys
2023-04-04 14:00:31 +02:00

39 lines
1.5 KiB
Bash

#!/bin/bash
# Copyright 2023, project-repo and the cagebreak contributors
# SPDX-License-Identifier: MIT
testdir="${MESONCURRENTCONFIGDIR}/_build-envvars"
mkdir "${testdir}"
mkdir "${testdir}/envvars/"
mkdir "${testdir}/cagebreak"
RESULT=0
# CAGEBREAK_SOCKET (duplicate of arguments test)
## Check without socket
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}/envvars"
readonly oldsocket="${CAGEBREAK_SOCKET}"
sed -i "s|CONFIGPATH|$testdir\/envvars\/socket|g" "${testdir}/envvars/config"
(WLR_BACKENDS=headless ./cagebreak -c "${testdir}/envvars/config")
sync
[[ $(cat "${testdir}/envvars/socket") = "${oldsocket}" ]] || RESULT=1
## Check with socket
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}/envvars"
sed -i "s|CONFIGPATH|$testdir\/envvars\/socket|g" "${testdir}/envvars/config"
(WLR_BACKENDS=headless ./cagebreak -e -c "${testdir}/envvars/config")
sync
[[ ! $(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}\/cagebreak\/result|g" "${testdir}/cagebreak/config"
XDG_CONFIG_HOME="${testdir}/" WLR_BACKENDS=headless ./cagebreak
sync
[[ $(cat "${testdir}/cagebreak/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.
rm -rf "${testdir}"
exit "${RESULT}"