aboutsummaryrefslogtreecommitdiff
path: root/test cases/common/38 run program/meson.build
blob: 5fe03d376367f35760d732dfc03b067b4ca319f0 (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
project('run command', 'c')

if host.name() == 'windows'
  c = run_command('cmd', '/c', 'echo', 'hello')
else
  c = run_command('echo', 'hello')
endif

correct = 'hello'

if c.returncode() != 0
  error('Executing echo failed.')
endif

result = c.stdout().strip()

if result != correct
  error('Getting stdout failed.')
endif

if c.stderr() != ''
  error('Extra text in stderr.')
endif

# Now the same with a script.

if host.name() == 'windows'
  cs = run_command('scripts/hello.bat')
else
  cs = run_command('scripts/hello.sh')
endif

if cs.returncode() != 0
  error('Executing script failed.')
endif

if cs.stdout().strip() != correct
  error('Getting stdout failed (script).')
endif

if cs.stderr() != ''
  error('Extra text in stderr (script).')
endif