Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / py-compile-env.test
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Make sure `py-compile' honours the PYTHON environment variable.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 cp "$testsrcdir/../lib/py-compile" .
24
25 cat > my-py <<'END'
26 #!/bin/sh
27 : > my-py.run
28 END
29 chmod a+x my-py
30
31 mkdir sub1
32 cd sub1
33
34 PYTHON=: ../py-compile foo.py
35 ls | grep . && Exit 1
36
37 PYTHON=false ../py-compile foo.py && Exit 1
38 ls | grep . && Exit 1
39
40 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py
41 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py | grep 'GrEpMe AndMeToo'
42 ls | grep . && Exit 1
43
44 cd ..
45 mkdir sub2
46 cd sub2
47
48 PYTHON=../my-py ../py-compile foo.py
49 test -f my-py.run
50 ls | grep -v '^my-py\.run$' | grep . && Exit 1
51
52 cd ..
53 mkdir sub3
54 cd sub3
55 PATH=..$PATH_SEPARATOR$PATH; export PATH
56 PYTHON=my-py py-compile foo.py
57 test -f my-py.run
58 ls | grep -v '^my-py\.run$' | grep . && Exit 1
59
60 :