diff options
author | Andrew Cady <d@cryptonomic.net> | 2021-10-23 12:52:42 -0400 |
---|---|---|
committer | Andrew Cady <d@cryptonomic.net> | 2021-10-23 12:52:42 -0400 |
commit | 2e5909e761f40e42684fbaa71f3b5bcb49500567 (patch) | |
tree | 335259ca973c5e07807fcb97fb09a1f49fb2a1dc /test | |
parent | 4d14156fd5b306b366b4d74e1a5bbf82e0ae081a (diff) |
move all files to EndoForge
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile | 38 | ||||
-rw-r--r-- | test/tests.sh | 66 |
2 files changed, 0 insertions, 104 deletions
diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index 3bc1a66..0000000 --- a/test/Makefile +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | .DEFAULT_GOAL = test | ||
2 | |||
3 | include ../Makefile | ||
4 | |||
5 | testuser = testuser | ||
6 | |||
7 | SU = $(SUDO) su | ||
8 | |||
9 | .PHONY: test useradd cleanuser | ||
10 | |||
11 | useradd: | ||
12 | $(SUDO) useradd $(testuser) --shell /bin/bash --create-home | ||
13 | $(SU) - $(testuser) -c 'ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""' | ||
14 | $(SU) - $(testuser) -c 'git config --global user.name $(testuser)' | ||
15 | $(SU) - $(testuser) -c 'git config --global user.email $(testuser)' | ||
16 | |||
17 | test: $(shell getent passwd $(testuser) >/dev/null || echo useradd) | ||
18 | $(ROOT_INSTALL) -t ~$(testuser) tests.sh | ||
19 | $(SU) - $(testuser) -c ./tests.sh | ||
20 | |||
21 | ifeq ($(testuser),) | ||
22 | $(error testuser not defined) | ||
23 | endif | ||
24 | cleanuser_command = $(SUDO) rm -I -r ~$(testuser) | ||
25 | |||
26 | cleanuser: | ||
27 | : Preparing to run destructive command: | ||
28 | : | ||
29 | : | ||
30 | : $(cleanuser_command) | ||
31 | : | ||
32 | : | ||
33 | : Press ctrl-c to abort. | ||
34 | : | ||
35 | @for n in 5 4 3 2 1; do printf ' %d\r' "$$n"; sleep 1; done | ||
36 | $(cleanuser_command) || true | ||
37 | $(SUDO) userdel testuser || true | ||
38 | |||
diff --git a/test/tests.sh b/test/tests.sh deleted file mode 100644 index 37f819f..0000000 --- a/test/tests.sh +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | set -ex | ||
3 | USER=u | ||
4 | DIR=src/anonymous-ssh | ||
5 | HOST=localhost | ||
6 | SSH_ID=~/.ssh/id_ed25519 | ||
7 | |||
8 | get_sshfp() | ||
9 | { | ||
10 | ( | ||
11 | key="$1" | ||
12 | r="${2:-.}" | ||
13 | dns=$(mktemp) || exit | ||
14 | trap 'rm -rf "$dns"' EXIT | ||
15 | |||
16 | ssh-keygen -r "$r" -f "$key" > "$dns" | ||
17 | exec < "$dns" | ||
18 | while read line | ||
19 | do | ||
20 | set -- $line | ||
21 | if [ "$3 $5" = "SSHFP 2" ] | ||
22 | then | ||
23 | echo "$line" | ||
24 | break | ||
25 | fi | ||
26 | done | ||
27 | ) | ||
28 | } | ||
29 | |||
30 | make_test_commit() | ||
31 | { | ||
32 | newfile=newfile.$(date -Ins|tr -d :) | ||
33 | touch "$newfile" | ||
34 | git add "$newfile" | ||
35 | git commit -m "$newfile" | ||
36 | } | ||
37 | |||
38 | [ -e "$SSH_ID" ] || ssh-keygen -t ed25519 -f "$SSH_ID" -P '' | ||
39 | |||
40 | git_namespace=$(set -- $(get_sshfp "$SSH_ID") && echo $6) | ||
41 | |||
42 | ssh -o NoHostAuthenticationForLocalhost=yes $USER@$HOST -- test || true | ||
43 | [ ! -e anonymous-ssh ] || rm -rf anonymous-ssh | ||
44 | export GIT_SSH_COMMAND="ssh -o NoHostAuthenticationForLocalhost=yes -i $SSH_ID" | ||
45 | git clone -v ${USER}@${HOST}:${DIR} | ||
46 | cd anonymous-ssh | ||
47 | |||
48 | make install | ||
49 | |||
50 | git pull --ff-only | ||
51 | make_test_commit | ||
52 | git push -f | ||
53 | make_test_commit | ||
54 | git push | ||
55 | git log -n4 | ||
56 | git pull --ff-only | ||
57 | git log -n4 | ||
58 | git push | ||
59 | |||
60 | # branch=$(git branch -q --show-current) | ||
61 | # forkname=origin-myfork | ||
62 | # ns_branch=refs/namespaces/$git_namespace/refs/heads/$branch | ||
63 | # git remote add -m "$ns_branch" "$forkname" $(git remote get-url origin) | ||
64 | # git push "$forkname" | ||
65 | # git pull "$forkname" --ff-only "$branch" | ||
66 | exit | ||