aboutsummaryrefslogtreecommitdiff
path: root/tests/worker/startup.test
blob: 550d8fd41f01e35cf4e73afa17006c0c2773b1bc (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# file      : tests/worker/startup.test
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license   : TBC; see accompanying LICENSE file

# Note: requires TFTP server (see buildfile).

test.options = --startup
tftp = 127.0.0.1:55123/test

: fail-download
:
$* --tftp-host "$tftp/$@" 2>>"EOE" &manifest != 0;
  curl: \(68\) TFTP: File Not Found
  error: unable to download task manifest from tftp://$tftp/$@/manifest: input/output error
  EOE
diff -u - manifest <<EOO
  : 1
  name: unknown
  version: 0
  status: abnormal
  EOO

: fail-manifest
:
cat <': 1' >=manifest;
$* --tftp-host "$tftp/$@" 2>>"EOE" != 0;
  error: invalid task manifest: manifest:2:1: no task package name specified
  EOE
diff -u - manifest <<EOO
  : 1
  name: unknown
  version: 0
  status: abnormal
  EOO

: fail-env-search
:
cat <<EOI >=manifest;
  : 1
  name: libhello
  version: 1.2.3
  repository: https://pkg.example.org/1/
  machine: linux-gcc
  target: x86_64-linux-gnu
  EOI
$* --environments $~ --tftp-host "$tftp/$@" 2>>"EOE" != 0;
  error: no environment setup executable in $representation($~) for target 'x86_64-linux-gnu'
  EOE
diff -u - manifest <<EOO
  : 1
  name: libhello
  version: 1.2.3
  status: abnormal
  EOO

: fail-env-run
:
cat <<EOI >=x86_64-linux-gnu;
  #!/bin/sh
  echo "environment setup failed"
  exit 1
  EOI
chmod ugo+x x86_64-linux-gnu;
cat <<EOI >=manifest;
  : 1
  name: libhello
  version: 1.2.3
  repository: https://pkg.example.org/1/
  machine: linux-gcc
  target: x86_64-linux-gnu
  EOI
$* --environments $~ --tftp-host "$tftp/$@" 2>>"EOE" != 0;
  environment setup failed
  error: process $~/x86_64-linux-gnu terminated with non-zero exit code
  EOE
diff -u - manifest <<EOO
  : 1
  name: libhello
  version: 1.2.3
  status: abnormal
  EOO

: pass
:
cat <<EOI >=x86_64-linux-gnu;
  #!/bin/sh
  echo "$1"
  echo "$2"
  EOI
chmod ugo+x x86_64-linux-gnu;
cat <<EOI >=manifest;
  : 1
  name: libhello
  version: 1.2.3
  repository: https://pkg.example.org/1/
  machine: linux-gcc
  target: x86_64-linux-gnu
  EOI
$* --environments $~ --tftp-host "$tftp/$@" 2>>"EOE"
  x86_64-linux-gnu
  $0
  EOE