File: test-credentials

package info (click to toggle)
gdbuspp 3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,116 kB
  • sloc: cpp: 9,462; python: 477; sh: 215; makefile: 6
file content (34 lines) | stat: -rwxr-xr-x 897 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#  GDBus++ - glib2 GDBus C++ wrapper
#
#  SPDX-License-Identifier: AGPL-3.0-only
#
#  Copyright (C)  OpenVPN Inc <sales@openvpn.net>
#  Copyright (C)  David Sommerseth <davids@openvpn.net>
#

set -eux

##
# @file tests/scripts/test-credentials
#
# @brief Runs a few test_credentials tests
#

run_creds_test()
{
    DEFAULT_ARGS="-E -d net.openvpn.gdbuspp.test.simple"
    echo ">> Running credentials test: ${BUILD_DIR:-.}/test_credentials ${DEFAULT_ARGS} $@"
    ${BUILD_DIR:-.}/test_credentials ${DEFAULT_ARGS} "$@"
}


run_creds_test -u -x "$(id -u)"

chk=$(dbus-send --session --dest=org.freedesktop.DBus \
        --type=method_call --print-reply=literal \
        /net/freedesktop/DBus  org.freedesktop.DBus.GetNameOwner \
        string:"net.openvpn.gdbuspp.test.simple" | tr -d ' ')
run_creds_test -b -x "${chk}"

[ -n "$SERVICE_PID" ] && run_creds_test -p -x "${SERVICE_PID}"