cagebreak/test/arguments
project-repo d19c32d7a4 Release 2.3.0
Functionality:
  * Add configuration to anchor position of messages (#60, 71 in Bugs.md).
  * Add output priorisation (#38, 68 in Bugs.md).
  * Print whether output is active in dump.

Bug Fixes:
  * Fix gamma control (72 in Bugs.md).
  * Add missing commands to example config.
  * Add message_config to dump output.

Example Scripts:
  * Add screenshot script.
  * Make example scripts standalone.

Documentation:
  * Escape html tags in config man page. (#68, 69 in Bugs.md)
  * Improve README.md (#62, 70 in Bugs.md).
  * Improve SECURITY.md.
  * Add CONTRIBUTING.md (#62, 70 in Bugs.md).
  * FAQ: Add Firefox screenshare instructions for wayland.
  * FAQ: Add wlroots downgrading instructions for workaround in case of temporary wlroots incompatibility.
  * Update copyright notices to 2024.

Development Tooling:
  * Add new gpg keys (signed by the old ones).
  * Add PR template.
  * Add dev-FAQ.
  * Remove now-unnecessary fanalyzer pragmas.
2024-01-26 10:53:03 +00:00

63 lines
2.2 KiB
Bash

#!/bin/bash
# Copyright 2023 - 2024, project-repo and the cagebreak contributors
# SPDX-License-Identifier: MIT
testdir="${MESONCURRENTCONFIGDIR}/_build-arguments/"
mkdir "${testdir}"
mkdir "${testdir}/arguments/"
readonly helptext="Usage: ./cagebreak [OPTIONS]
-c <path> Load configuration file from <path>
-e Enable socket
-h Display this help message
-s Show information about the current setup and exit
-v Show the version number and exit
--bs \"bad security\": Enable features with potential security implications (see man page)"
readonly basicheadless="Cagebreak ${1} is running on Wayland display wayland-.*
Outputs:
\\* HEADLESS-1
Inputs:"
RESULT=0
# check -c option
## Check without config file
[[ $(2>&1 ./cagebreak -c | head -1 ) = "./cagebreak: option requires an argument -- 'c'" ]] || RESULT=1
[[ $(2>&1 ./cagebreak -c | tail -n +2 ) = "$helptext" ]] || RESULT=1
## Check with config file
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/-c-config" "${testdir}/arguments/"
sed -i "s|CONFIGPATH|${testdir}\/arguments\/result|g" "${testdir}/arguments/-c-config"
WLR_BACKENDS=headless ./cagebreak -c "${testdir}/arguments/-c-config"
sync
[[ $(cat "${testdir}/arguments/result") = "SUCCESS" ]] || RESULT=1
# check -e option
## Check without socket
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}/arguments"
readonly oldsocket=$CAGEBREAK_SOCKET
sed -i "s|CONFIGPATH|${testdir}\/arguments\/socket|g" "${testdir}/arguments/config"
(WLR_BACKENDS=headless ./cagebreak -c "${testdir}/arguments/config")
sync
[[ $(cat "${testdir}/arguments/socket") = "${oldsocket}" ]] || RESULT=1
## Check with socket
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}/arguments"
sed -i "s|CONFIGPATH|$testdir\/arguments\/socket|g" "${testdir}/arguments/config"
(WLR_BACKENDS=headless ./cagebreak -e -c "${testdir}/arguments/config")
sync
[[ ! $(cat "${testdir}/arguments/socket") = "${oldsocket}" ]] || RESULT=1
# check -h option
[[ $(./cagebreak -h) = "$helptext" ]] || RESULT=1
# check -s option
[[ $(WLR_BACKENDS=headless ./cagebreak -s) =~ ${basicheadless} ]] || RESULT=1
# check -v option
[[ $(./cagebreak -v) = "Cagebreak version $1" ]] || RESULT=1
rm -rf "${testdir}"
exit "${RESULT}"