build: fix cleaning of test directories in contrib (and in t/perf)
[platform/upstream/automake.git] / t / py-compile-basic2.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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 # Test more basic functionalities of the 'py-compile' script, with
18 # dummy python sources, but more complex directory layouts.  See also
19 # related test 'py-compile-basic.test'.
20
21 required=python
22 . ./defs || exit 1
23
24 ocwd=$(pwd) || fatal_ "getting current working directory"
25
26 pyfiles="
27   foo.py
28   ./foo1.py
29   ../foo2.py
30   ../dir/foo3.py
31   $ocwd/foo4.py
32   sub/bar.py
33   sub/subsub/barbar.py
34   __init__.py
35   sub/__init__.py
36   1.py
37   .././_.py
38 "
39
40 lst='
41   dir/foo
42   dir/foo1
43   foo2
44   dir/foo3
45   foo4
46   dir/sub/bar
47   dir/sub/subsub/barbar
48   dir/__init__
49   dir/sub/__init__
50   dir/1
51   _
52 '
53
54 mkdir dir
55 cd dir
56 cp "$am_scriptdir/py-compile" . \
57   || fatal_ "failed to fetch auxiliary script py-compile"
58 mkdir sub sub/subsub
59 touch $pyfiles
60 ./py-compile $pyfiles
61 cd "$ocwd"
62
63 for x in $lst; do echo $x.pyc; echo $x.pyo; done | sort > exp
64 find . -name '*.py[co]' | sed 's|^\./||' | sort > got
65
66 cat exp
67 cat got
68 diff exp got
69
70 :