summaryrefslogtreecommitdiff
path: root/test/CFILESUFFIX.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-03-10 19:39:12 +0000
committerSteven Knight <knight@baldmt.com>2002-03-10 19:39:12 +0000
commit3f2c0a0cb3e65e01263f315cc5d1a017537de1c9 (patch)
tree4a65a83ac6fbb477bc2f35b16540ac136d024831 /test/CFILESUFFIX.py
parent952df96acecd62355d351976be1384f4e7d4bc17 (diff)
downloadscons-3f2c0a0cb3e65e01263f315cc5d1a017537de1c9.tar.gz
Make the C*FILESUFFIX.py, LEX*.py and YACC*.py tests not dependent on the system's lex or yacc.
Diffstat (limited to 'test/CFILESUFFIX.py')
-rw-r--r--test/CFILESUFFIX.py52
1 files changed, 22 insertions, 30 deletions
diff --git a/test/CFILESUFFIX.py b/test/CFILESUFFIX.py
index 002a756e..5c046865 100644
--- a/test/CFILESUFFIX.py
+++ b/test/CFILESUFFIX.py
@@ -32,47 +32,39 @@ import TestSCons
python = sys.executable
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
-
-lex = None
-for dir in string.split(os.environ['PATH'], os.pathsep):
- l = os.path.join(dir, 'lex' + _exe)
- if os.path.exists(l):
- lex = l
- break
-
test = TestSCons.TestSCons()
-test.no_result(not lex)
+test.write('mylex.py', """
+import getopt
+import string
+import sys
+cmd_opts, args = getopt.getopt(sys.argv[1:], 't', [])
+for a in args:
+ contents = open(a, 'rb').read()
+ sys.stdout.write(string.replace(contents, 'LEX', 'mylex.py'))
+sys.exit(0)
+""")
test.write('SConstruct', """
-Environment().CFile(target = 'foo', source = 'foo.l')
-Environment(CFILESUFFIX = '.xyz').CFile(target = 'bar', source = 'bar.l')
-""")
+env = Environment(LEX = r'%s mylex.py')
+env.CFile(target = 'foo', source = 'foo.l')
+env.Copy(CFILESUFFIX = '.xyz').CFile(target = 'bar', source = 'bar.l')
+""" % python)
-lex = r"""
-%%%%
-a printf("A%sA");
-b printf("B%sB");
-%%%%
+input = r"""
int
-yywrap()
-{
- return 1;
-}
-
-main()
+main(int argc, char *argv[])
{
- yylex();
+ argv[argc++] = "--";
+ printf("LEX\n");
+ printf("%s\n");
+ exit (0);
}
"""
-test.write('foo.l', lex % ('foo.l', 'foo.l'))
+test.write('foo.l', input % 'foo.l')
-test.write('bar.l', lex % ('bar.l', 'bar.l'))
+test.write('bar.l', input % 'bar.l')
test.run(arguments = '.')