File: test007.py

package info (click to toggle)
aap 1.072-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,980 kB
  • ctags: 2,160
  • sloc: python: 15,113; makefile: 61; sh: 31
file content (42 lines) | stat: -rw-r--r-- 874 bytes parent folder | download | duplicates (2)
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
# Part of the A-A-P recipe executive: Testing passing variable on cmdline

# Copyright (C) 2002-2003 Stichting NLnet Labs
# Permission to copy and use this file is specified in the file COPYING.
# If this file is missing you can find it here: http://www.a-a-p.org/COPYING

import sys, os

def runaap(args):
    return os.system("%s ..%sMain.py %s" % (sys.argv[1], os.sep, args))

os.chdir("rectest")

# Create a very simple recipe and try running it.
rec = "rectest.aap"
out = "rectest.out"

f = open(rec, "w")
f.write("""
BBB ?= xxx
CCC = yyy
all:
    :print $AAA $BBB $CCC
""")
f.close()

res = runaap("-f %s AAA=aaa BBB=bbb CCC=ccc >%s" % (rec, out))

f = open(out)
l = f.read()
if l != "aaa bbb yyy\n":
    print 'Aap returned "%s" instead of "aaa bbb yyy"' % l
    res = 1
f.close()

os.remove(rec)
os.remove(out)

sys.exit(res)


# vim: set sw=4 et sts=4 tw=79 fo+=l: