summaryrefslogtreecommitdiff
path: root/test/hg-hg
blob: afaf05f5bc170f95fc903a85282997125025ee94 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

# Copyright 2017 Bob Proulx <bob@proulx.com>
# You may freely use, modify and/or distribute this file.

# Ensure a standard behavior regardless of caller locale setting.
export LC_ALL=C

unset tmpdir
cleanup() {
  test -n "$tmpdir" && rm -rf "$tmpdir" && unset tmpdir
}
trap "cleanup" EXIT
trap "cleanup; trap - HUP; kill -HUP $$" HUP
trap "cleanup; trap - INT; kill -INT $$" INT
trap "cleanup; trap - QUIT; kill -QUIT $$" QUIT
trap "cleanup; trap - TERM; kill -TERM $$" TERM

tmpdir=$(mktemp -d -t "sv-test.XXXXXXXX") || exit 1

cd "$tmpdir" || exit 1

testit() {
  url=$1 ; shift

  # '--insecure' needed because old 'hg' do not support SNI.
  # see https://lists.gnu.org/archive/html/savannah-hackers-public/2017-01/msg00028.html
  hg clone --insecure -q "$url"
  if [ $? -ne 0 ]; then
    echo "Failed to hg clone $url"
    exit 1
  fi
  base=$(basename "$url")
  test -d "$base" || exit 1
  rm -rf "$base"
  test -d "$base" && exit 1
}

HGPROJ=${HGPROJ:-test-project}

for h in http https ; do
  for s in savannah sv ; do
      for t in gnu nongnu ; do
        url=="$h://hg.$s.$t.org/hgweb/${HGPROJ}"
        testit "$url"
    done
  done
done

exit 0