Skip to content

Commit 38a547d

Browse files
committed
build: make scripts for remote testing usable
This updates `scripts/remote_tests_{rust,python}.sh`. The scripts were previously used to run tests from CI on remote faster machine, but they are still usable to run tests remotely e.g. from a laptop that is on battery.
1 parent 7c998af commit 38a547d

File tree

3 files changed

+28
-45
lines changed

3 files changed

+28
-45
lines changed

scripts/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ and an own build machine.
2626
i.e. `deltachat-rpc-client` and `deltachat-rpc-server`.
2727

2828
- `remote_tests_python.sh` rsyncs to a build machine and runs
29-
`run-python-test.sh` remotely on the build machine.
29+
JSON-RPC Python tests remotely on the build machine.
3030

3131
- `remote_tests_rust.sh` rsyncs to the build machine and runs
32-
`run-rust-test.sh` remotely on the build machine.
32+
Rust tests remotely on the build machine.
3333

3434
- `run-doxygen.sh` generates C-docs which are then uploaded to https://c.delta.chat/
3535

scripts/remote_tests_python.sh

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,32 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
set -euo pipefail
23

3-
BUILD_ID=${1:?specify build ID}
4-
5-
SSHTARGET=${SSHTARGET-ci@b1.delta.chat}
6-
BUILDDIR=ci_builds/$BUILD_ID
4+
set -x
5+
if ! test -v SSHTARGET; then
6+
echo >&2 SSHTARGET is not set
7+
exit 1
8+
fi
9+
BUILDDIR=ci_builds/chatmailcore
710

811
echo "--- Copying files to $SSHTARGET:$BUILDDIR"
912

10-
set -xe
11-
12-
ssh -oBatchMode=yes -oStrictHostKeyChecking=no $SSHTARGET mkdir -p "$BUILDDIR"
13-
git ls-files >.rsynclist
14-
# we seem to need .git for setuptools_scm versioning
15-
find .git >>.rsynclist
16-
rsync --delete --files-from=.rsynclist -az ./ "$SSHTARGET:$BUILDDIR"
17-
18-
set +x
13+
rsync -az --delete --mkpath --files-from=<(git ls-files) ./ "$SSHTARGET:$BUILDDIR"
1914

2015
echo "--- Running Python tests remotely"
2116

22-
ssh $SSHTARGET <<_HERE
17+
ssh -oBatchMode=yes -- "$SSHTARGET" <<_HERE
2318
set +x -e
2419
2520
# make sure all processes exit when ssh dies
2621
shopt -s huponexit
2722
28-
export RUSTC_WRAPPER=\`which sccache\`
23+
export RUSTC_WRAPPER=\`command -v sccache\`
2924
cd $BUILDDIR
30-
export TARGET=release
3125
export CHATMAIL_DOMAIN=$CHATMAIL_DOMAIN
3226
33-
#we rely on tox/virtualenv being available in the host
34-
#rm -rf virtualenv venv
35-
#virtualenv -q -p python3.7 venv
36-
#source venv/bin/activate
37-
#pip install -q tox virtualenv
38-
39-
set -x
40-
which python
41-
source \$HOME/venv/bin/activate
42-
which python
27+
scripts/make-rpc-testenv.sh
28+
. venv/bin/activate
4329
44-
bash scripts/run-python-test.sh
30+
cd deltachat-rpc-client
31+
pytest -n6 $@
4532
_HERE

scripts/remote_tests_rust.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
set -euo pipefail
23

3-
BUILD_ID=${1:?specify build ID}
4-
5-
SSHTARGET=${SSHTARGET-ci@b1.delta.chat}
6-
BUILDDIR=ci_builds/$BUILD_ID
7-
8-
set -e
4+
if ! test -v SSHTARGET; then
5+
echo >&2 SSHTARGET is not set
6+
exit 1
7+
fi
8+
BUILDDIR=ci_builds/chatmailcore
99

1010
echo "--- Copying files to $SSHTARGET:$BUILDDIR"
1111

12-
ssh -oBatchMode=yes -oStrictHostKeyChecking=no $SSHTARGET mkdir -p "$BUILDDIR"
13-
git ls-files >.rsynclist
14-
rsync --delete --files-from=.rsynclist -az ./ "$SSHTARGET:$BUILDDIR"
12+
rsync -az --delete --mkpath --files-from=<(git ls-files) ./ "$SSHTARGET:$BUILDDIR"
1513

1614
echo "--- Running Rust tests remotely"
1715

18-
ssh $SSHTARGET <<_HERE
16+
ssh -oBatchMode=yes -- "$SSHTARGET" <<_HERE
1917
set +x -e
2018
# make sure all processes exit when ssh dies
2119
shopt -s huponexit
22-
export RUSTC_WRAPPER=\`which sccache\`
20+
export RUSTC_WRAPPER=\`command -v sccache\`
2321
cd $BUILDDIR
24-
export TARGET=x86_64-unknown-linux-gnu
25-
export RUSTC_WRAPPER=sccache
2622
27-
bash scripts/run-rust-test.sh
23+
cargo nextest run
2824
_HERE
2925

0 commit comments

Comments
 (0)