| 1 |
#!/bin/bash |
| 2 |
# GDBus++ - glib2 GDBus C++ wrapper |
| 3 |
# |
| 4 |
# SPDX-License-Identifier: AGPL-3.0-only |
| 5 |
# |
| 6 |
# Copyright (C) OpenVPN Inc <[email protected]> |
| 7 |
# Copyright (C) David Sommerseth <[email protected]> |
| 8 |
# |
| 9 |
|
| 10 |
set -eux |
| 11 |
|
| 12 |
## |
| 13 |
# @file tests/scripts/test-credentials |
| 14 |
# |
| 15 |
# @brief Runs a few test_credentials tests |
| 16 |
# |
| 17 |
|
| 18 |
run_creds_test() |
| 19 |
{ |
| 20 |
DEFAULT_ARGS="-E -d net.openvpn.gdbuspp.test.simple" |
| 21 |
echo ">> Running credentials test: ${BUILD_DIR:-.}/test_credentials ${DEFAULT_ARGS} $@" |
| 22 |
${BUILD_DIR:-.}/test_credentials ${DEFAULT_ARGS} "$@" |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
run_creds_test -u -x "$(id -u)" |
| 27 |
|
| 28 |
chk=$(dbus-send --session --dest=org.freedesktop.DBus \ |
| 29 |
--type=method_call --print-reply=literal \ |
| 30 |
/net/freedesktop/DBus org.freedesktop.DBus.GetNameOwner \ |
| 31 |
string:"net.openvpn.gdbuspp.test.simple" | tr -d ' ') |
| 32 |
run_creds_test -b -x "${chk}" |
| 33 |
|
| 34 |
[ -n "$SERVICE_PID" ] && run_creds_test -p -x "${SERVICE_PID}" |