Coverage for autom4te cache creation issues.

View: New views
3 Messages — Rating Filter:   Alert me  

Coverage for autom4te cache creation issues.

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is purely to increase coverage of bin/autom4te by a bit.  OK?

Thanks,
Ralf

    Coverage for autom4te cache creation issues.
   
    * tests/tools.at (autom4te cache creation): New test.

diff --git a/tests/tools.at b/tests/tools.at
index 20a0f43..8a15301 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -1167,6 +1167,47 @@ AT_CHECK([test "`find configure -newer newer`" = "" ||
 AT_CLEANUP
 
 
+# autom4te cache creation
+# -----------------------
+# Ensure autom4te fails when it cannot create the cache directory
+# or create files there.
+AT_SETUP([autom4te cache creation])
+
+# Work in a subdirectory so autotest can scribble in the toplevel.
+mkdir sub
+chmod a-w sub
+
+AT_DATA([configure.ac],
+[[AC_INIT
+]])
+
+AT_DATA([.autom4te.cfg],
+[[begin-language: "Autoconf-without-aclocal-m4"
+args: --cache=sub/autom4te.cache
+end-language: "Autoconf-without-aclocal-m4"
+]])
+
+# Do not try this when we are root or on systems without permissions.
+AT_CHECK([: > sub/some-file && exit 77], 1, [ignore], [ignore])
+
+# Failure to create cache directory.
+AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
+AT_CHECK([grep 'cannot create .*autom4te.cache' stderr], [0], [ignore])
+AT_CHECK([test -f configure], [1])
+
+chmod u+w sub
+AT_CHECK_AUTOCONF
+
+rm -f configure sub/autom4te.cache/*
+chmod a-w sub/autom4te.cache
+
+# Failure to create a file in the cache directory.
+AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
+AT_CHECK([grep 'cannot open.*autom4te.cache' stderr], [0], [ignore])
+
+AT_CLEANUP
+
+
 # autom4te cache locking
 # ----------------------
 



Re: Coverage for autom4te cache creation issues.

by Paolo Bonzini-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/04/2009 07:38 AM, Ralf Wildenhues wrote:
> This is purely to increase coverage of bin/autom4te by a bit.  OK?

Looks good, you may want to add a u-r test too.

Paolo




Re: Coverage for autom4te cache creation issues.

by Eric Blake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Ralf Wildenhues on 11/3/2009 11:38 PM:
> This is purely to increase coverage of bin/autom4te by a bit.  OK?
>
> Thanks,
> Ralf
>
>     Coverage for autom4te cache creation issues.
>    
>     * tests/tools.at (autom4te cache creation): New test.

Every bit of coverage helps.  Go ahead and commit.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrxc/IACgkQ84KuGfSFAYBeIACgiK/dKZcwqR/l4f8Zyg6x/HgM
e3wAnjRuv6DnWqR1AGjhIJaNKdtAmfmo
=7DDc
-----END PGP SIGNATURE-----