]> git.draconx.ca Git - dxcommon.git/blobdiff - tests/scripts.at
fix-gnulib: Ensure header rules create output directory.
[dxcommon.git] / tests / scripts.at
index 9c5f56a950eb4391aa8d3b390117a53c4956bc10..4a838077250eaa6c5a6c8be1e433cbc0acbc3837 100644 (file)
@@ -589,9 +589,13 @@ test_fix_gnulib () {
   $PERL -f "$srcdir/scripts/fix-gnulib.pl" "$@"
 }
 test_gnulib_mk () {
-  echo; sed -n -f - "$srcdir/tests/data/gnulib.mk" <<EOF
-/^## begin gnulib module $1/,/^## end   gnulib module $1/p
+  echo;
+  for arg
+  do
+    sed -n -f - "$srcdir/tests/data/gnulib.mk" <<EOF
+/^## begin gnulib module $arg/,/^## end   gnulib module $arg/p
 EOF
+  done
 }
 m4_divert_pop([PREPARE_TESTS])
 
@@ -647,6 +651,40 @@ EXTRA_LIBRARIES += libgnu.a
 
 AT_CLEANUP
 
+AT_SETUP([fix-gnulib.pl header directory creation])
+
+AT_DATA([extract.sed],
+[[/AM_V_GEN/b ok
+/gl_V_at/b ok
+s/:.*/:/
+h
+b
+:ok
+s/'//g
+x
+G
+p
+n
+s/[)].*/)/
+p
+]])
+
+test_gnulib_mk alloca-opt sys_types stddef >test.mk.in
+AT_CHECK([test_fix_gnulib -i test.mk.in -o test.mk || exit
+sed -n -f extract.sed test.mk], [0],
+[[lib/alloca.h:
+       $(AM_V_GEN)$(MKDIR_P) lib
+       $(AM_V_at)
+lib/sys/types.h:
+       $(AM_V_GEN)$(MKDIR_P) lib/sys
+       $(AM_V_at)
+lib/stddef.h:
+       $(AM_V_GEN)$(MKDIR_P) lib
+       $(AM_V_at)
+]])
+
+AT_CLEANUP
+
 dnl TEST_FIND_AUTOMAKE_VER([to-check], [test-action])
 dnl
 dnl For each whitespace-separated version token in to-check, check if we can