2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
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)
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.
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/>.
17 # Test that a readonly files are distributed as such, and not make
18 # writable while being copied in the $(distdir).
20 # This test expect the user to be unable to write on files lacking
21 # write permissions -- so it won't work if the user is 'root'.
22 required
='non-root cc'
25 cat >> configure.ac
<< 'END'
30 cat > Makefile.am
<< 'END'
37 test -f $
(srcdir
)/foo.c
&& test ! -w $
(srcdir
)/foo.c
38 if (echo x
> $
(srcdir
)/foo.c
); then exit 1; else :; fi
39 grep 'main (void)' $
(srcdir
)/foo.c
40 test -f $
(srcdir
)/bar.txt
&& test ! -w $
(srcdir
)/bar.txt
41 if (echo x
> $
(srcdir
)/bar.txt
); then exit 1; else :; fi
42 grep 'To be, or not to be' $
(srcdir
)/bar.txt
45 echo 'int main (void) { return 0; }' > foo.c
46 echo To be
, or not to be ...
> bar.txt
47 chmod a-w foo.c bar.txt
55 ls -l $distdir # For debugging.
56 test -f foo.c
&& test ! -w foo.c ||
exit 1
57 (echo x
> foo.c
) && exit 1
58 test -f bar.txt
&& test ! -w bar.txt ||
exit 1
59 (echo x
> bar.txt
) && exit 1