File: unit

package info (click to toggle)
borgbackup2 2.0.0b20-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 16,848 kB
  • sloc: python: 33,830; pascal: 3,599; sh: 215; makefile: 160; tcl: 94; ansic: 21
file content (37 lines) | stat: -rw-r--r-- 963 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
35
36
37
#!/usr/bin/sh

set -euo pipefail

cleanup() {
  # preserve exit code
  exit_code="$?"
  echo 'Remove user/group "übel" again'
  sudo groupdel übel || /usr/bin/true
  sudo userdel übel || /usr/bin/true
  exit "${exit_code}"
}

trap cleanup EXIT

echo "Creating user 'übel', used in src/borg/testsuite/platform.py::test_non_ascii_acl"
GROUPENTRY='übel:x:666:'
# gross hack because groupadd can't handle bad names
grep "${GROUPENTRY}" /etc/group || sudo sh -c "echo ${GROUPENTRY} >> /etc/group"
id übel 2> /dev/null || sudo useradd --uid 666 --gid 666 --badname übel

echo "Create borg.exe symlink for many tests in src/borg/testsuite/archiver.py"
mkdir bin
ln -s /usr/bin/borg ./bin/borg.exe
PATH="$(pwd)/bin/:${PATH}"
export PATH
echo export PATH="$PATH" >> ~/.profile

echo "Running the unit test suite ..."

TEST_INSTALLED_CODE=1 \
PYTHONPATH=/usr/lib/borgbackup2 \
pytest \
  -n auto -rs \
  --cov-branch \
  --benchmark-skip \
  --pyargs borg.testsuite