15c2932
#!/bin/sh
15c2932
set -eux
15c2932
2734e8d
cd "$SOURCE"
2734e8d
b6bc45d
. /etc/os-release
6c679be
test_optional=
6c679be
test_basic=
b6bc45d
2734e8d
if ls ../cockpit-appstream* 1> /dev/null 2>&1; then
b6bc45d
    test_optional=1
b6bc45d
else
b6bc45d
    test_basic=1
b6bc45d
fi
b6bc45d
b6bc45d
if [ "$ID" = "fedora" ]; then
b6bc45d
    test_basic=1
b6bc45d
    test_optional=1
b6bc45d
fi
b6bc45d
15c2932
# tests need cockpit's bots/ libraries
15c2932
git clone --depth=1 https://github.com/cockpit-project/bots
b6bc45d
15c2932
# only install a subset to save time/space
15c2932
npm install axe-core chrome-remote-interface sizzle
15c2932
6d1be3e
export TEST_OS="${ID}-${VERSION_ID/./-}"
6d1be3e
# HACK: upstream does not yet know about fedora rawhide
6d1be3e
if [ "$TEST_OS" = "fedora-33" ]; then
6d1be3e
    export TEST_OS=fedora-32
6d1be3e
fi
15c2932
a6f0e0a
# HACK: CI hits this selinux denial. Unrelated to our tests.
5f7e778
export TEST_ALLOW_JOURNAL_MESSAGES=".*Permission denied:.*/var/cache/app-info/xmls.*"
15c2932
ecd7b62
# select tests
ecd7b62
TESTS=""
1c54526
EXCLUDES=""
ecd7b62
RC=0
b6bc45d
if [ -n "$test_optional" ]; then
a043a83
    # pre-download cirros image for Machines tests
a043a83
    bots/image-download cirros
a043a83
1c54526
    # still too unstable
1c54526
    EXCLUDES="$EXCLUDES
1c54526
    TestMachines.testCreate
1c54526
    TestMachines.testNetworkSettings
1c54526
    TestMachines.testVmNICs"
1c54526
1c54526
    # triggers SELinux violation
1c54526
    EXCLUDES="$EXCLUDES TestMachines.testAddDisk"
b6bc45d
1c54526
    # TestUpdates: we can't run rebooting tests
ecd7b62
    TESTS="$TESTS
a043a83
         TestAutoUpdates
1c54526
         TestMachines
1c54526
         TestStorage
1c54526
         TestUpdates.testBasic
1c54526
         TestUpdates.testSecurityOnly"
b6bc45d
fi
b6bc45d
b6bc45d
if [ -n "$test_basic" ]; then
1c54526
    # still too unstable
1c54526
    EXCLUDES="$EXCLUDES TestFirewall.testNetworkingPage"
ecd7b62
12407e7
    # TODO: fix for CI environment
12407e7
    EXCLUDES="$EXCLUDES TestLogin.testTally"
12407e7
1c54526
    # PAM bug in RHEL 8: it shouldn't pwquality the old password when having to set a new one, that's completely counter-productive and wrong
029dfa3
    if [ "${TEST_OS#rhel}" != "$TEST_OS" ]; then
1c54526
        EXCLUDES="$EXCLUDES TestLogin.testExpired"
029dfa3
    fi
029dfa3
ecd7b62
    TESTS="$TESTS
ecd7b62
        TestAccounts
1c54526
        TestFirewall
1c54526
        TestLogin
ecd7b62
        TestNetworking
ecd7b62
        TestSOS"
ecd7b62
fi
ecd7b62
1c54526
# HACK: use fixed run-tests for BlockingIOError and --exclude, until version 222 gets packaged
8cdec9d
curl https://raw.githubusercontent.com/cockpit-project/cockpit/master/test/common/run-tests > test/common/run-tests
8cdec9d
chmod a+x test/common/run-tests
8cdec9d
1c54526
exclude_options=""
1c54526
for t in $EXCLUDES; do
1c54526
    exclude_options="$exclude_options --exclude $t"
1c54526
done
1c54526
ecd7b62
# execute run-tests
1c54526
test/common/run-tests --test-dir test/verify --trace --verbose --nondestructive $exclude_options \
ecd7b62
    --machine localhost:22 --browser localhost:9090 $TESTS || RC=$?
ecd7b62
ecd7b62
# check-menu is not @nondestructive yet, keep it last
ecd7b62
if [ -n "$test_basic" ]; then
ecd7b62
    test/verify/check-menu -tv --machine localhost:22 --browser localhost:9090 || RC=$?
b6bc45d
fi
15c2932
6d1be3e
echo $RC > "$LOGS/exitcode"
6d1be3e
cp --verbose Test* "$LOGS" || true
6d1be3e
# deliver test result via exitcode file
6d1be3e
exit 0