Rombobjörn

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/inputs/clean2
-rw-r--r--testsuite/inputs/default_build3
-rw-r--r--testsuite/library60
-rwxr-xr-xtestsuite/run_tests12
-rw-r--r--testsuite/sources/empty/generated_files0
-rw-r--r--testsuite/sources/library_1/Makefile20
-rw-r--r--testsuite/sources/library_1/build_testcase.gpr.gp34
-rw-r--r--testsuite/sources/library_1/generated_files7
-rw-r--r--testsuite/sources/library_1/testcase.adb24
-rw-r--r--testsuite/sources/library_1/testcase.ads18
-rw-r--r--testsuite/sources/library_1/testcase.gpr.gp27
11 files changed, 191 insertions, 16 deletions
diff --git a/testsuite/inputs/clean b/testsuite/inputs/clean
index a0d18f9..2b37fec 100644
--- a/testsuite/inputs/clean
+++ b/testsuite/inputs/clean
@@ -1,4 +1,4 @@
-common_setup
expect_configuration
+common_setup
make
make clean
diff --git a/testsuite/inputs/default_build b/testsuite/inputs/default_build
index af01356..635b842 100644
--- a/testsuite/inputs/default_build
+++ b/testsuite/inputs/default_build
@@ -1,3 +1,4 @@
-common_setup
expect_configuration
+expect_generated_files
+common_setup
make
diff --git a/testsuite/library b/testsuite/library
index 2d16973..c665c71 100644
--- a/testsuite/library
+++ b/testsuite/library
@@ -1,5 +1,5 @@
# function library for Comfignat's testcases
-# Copyright 2013 B. Persson, Bjorn@Rombobeorn.se
+# Copyright 2013 - 2014 B. Persson, Bjorn@Rombobeorn.se
#
# This material is provided as is, with absolutely no warranty expressed
# or implied. Any use is at your own risk.
@@ -11,6 +11,54 @@
# modified is included with the above copyright notice.
+# These directory variables mustn't be conveyed from Comfignat, because then
+# the testsuite would rely on the same thing that it's supposed to test.
+prefix=/usr/local
+exec_prefix=${prefix}
+datarootdir=${prefix}/share
+bindir=${exec_prefix}/bin
+libexecdir=${exec_prefix}/libexec
+includedir=${prefix}/include
+libdir=${exec_prefix}/lib
+alidir=${libdir}
+gprdir=${datarootdir}/gpr
+stagedir=stage
+stage_bindir=${stagedir}${bindir}
+stage_libexecdir=${stagedir}${libexecdir}
+stage_includedir=${stagedir}${includedir}
+stage_libdir=${stagedir}${libdir}
+stage_alidir=${stagedir}${alidir}
+stage_gprdir=${stagedir}${gprdir}
+
+
+expect_configuration () {
+ # If "always" is passed, the testcase is always expected to leave a
+ # configuration file. If this is called without "always", a configuration
+ # file is expected only in a separate build directory.
+ if [ "$1" = always -o "${relative_builddir}" != . ] ; then
+ echo "${builddir}"/comfignat_configuration.mk >>"${file_list}"
+ fi
+}
+
+
+expect_generated_files () {
+ # The testcase is expected to generate files which are listed in the file
+ # generated_files. The list is whitespace-separated and may contain shell
+ # variable references.
+ for file in $(cat "${srcdir}"/generated_files) ; do
+ # Expand variables in the string to get the pathname.
+ eval file="${file}"
+ # Write the pathname and its parent directories to the file list.
+ # Chop off pathname components until only "." remains, but also avoid
+ # looping forever if the final residue turns out to be "/" or "//".
+ while [ "${file}" != . -a "${file}" != / -a "${file}" != // ] ; do
+ echo "${builddir}/${file}" >>"${file_list}"
+ file=$(dirname "${file}")
+ done
+ done
+}
+
+
common_setup () {
# When the locations file specifies a separate build directory, initialize
# the build directory and go there. When the source directory is also the
@@ -22,13 +70,3 @@ common_setup () {
cd "${relative_builddir}"
fi
}
-
-
-expect_configuration () {
- # If "always" is passed, the testcase is always expected to leave a
- # configuration file. If this is called without "always", a configuration
- # file is expected only in a separate build directory.
- if [ "$1" = always -o "${relative_builddir}" != . ] ; then
- echo "${builddir}"/comfignat_configuration.mk >>"${file_list}"
- fi
-}
diff --git a/testsuite/run_tests b/testsuite/run_tests
index 35fcc23..f440f8d 100755
--- a/testsuite/run_tests
+++ b/testsuite/run_tests
@@ -1,7 +1,7 @@
#!/bin/sh
# Comfignat's testsuite
-# Copyright 2013 B. Persson, Bjorn@Rombobeorn.se
+# Copyright 2013 - 2014 B. Persson, Bjorn@Rombobeorn.se
#
# This material is provided as is, with absolutely no warranty expressed
# or implied. Any use is at your own risk.
@@ -90,8 +90,14 @@ for source_directory in "${outer_srcdir}"/testsuite/sources/* ; do
if sh -e -c ". ${outer_srcdir}/testsuite/library; . ${input_script}" >output 2>&1 ; then
# Check that the expected files and no others are present.
- LC_COLLATE=C sort -o files.expected files.expected
- if find "${srcdir}" "${builddir}" | LC_COLLATE=C sort | diff files.expected - >files.diff ; then
+ # Sort the list of expected files and remove duplicates.
+ LC_COLLATE=C sort -u -o files.expected files.expected
+ # List all files in the build directory except for the directory
+ # where intermediate files are suposed to be. List the files in the
+ # source directory separately if the directories are separate. Sort
+ # the combined list the same way as the list of expected files is
+ # sorted. Then compare the lists.
+ if ( find "${builddir}" | grep -v ^"${builddir}"/obj ; test "${relative_builddir}" != . && find "${srcdir}" ) | LC_COLLATE=C sort | diff files.expected - >files.diff ; then
# Check that the source files haven't been mangled.
cd "${source_directory}"
diff --git a/testsuite/sources/empty/generated_files b/testsuite/sources/empty/generated_files
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/testsuite/sources/empty/generated_files
diff --git a/testsuite/sources/library_1/Makefile b/testsuite/sources/library_1/Makefile
new file mode 100644
index 0000000..f0c587b
--- /dev/null
+++ b/testsuite/sources/library_1/Makefile
@@ -0,0 +1,20 @@
+# part of Comfignat's testsuite
+# Copyright 2014 B. Persson, Bjorn@Rombobeorn.se
+#
+# This material is provided as is, with absolutely no warranty expressed
+# or implied. Any use is at your own risk.
+#
+# Permission is hereby granted to use or copy this testsuite
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+
+
+include comfignat.mk
+
+options = frobnicate
+frobnicate = false
+
+build_GPRs = build_testcase.gpr
+usage_GPRs = testcase.gpr
diff --git a/testsuite/sources/library_1/build_testcase.gpr.gp b/testsuite/sources/library_1/build_testcase.gpr.gp
new file mode 100644
index 0000000..abfa866
--- /dev/null
+++ b/testsuite/sources/library_1/build_testcase.gpr.gp
@@ -0,0 +1,34 @@
+-- Comfignat's testsuite
+-- Copyright 2014 B. Persson, Bjorn@Rombobeorn.se
+--
+-- This material is provided as is, with absolutely no warranty expressed
+-- or implied. Any use is at your own risk.
+--
+-- Permission is hereby granted to use or copy this testsuite
+-- for any purpose, provided the above notices are retained on all copies.
+-- Permission to modify the code and to distribute modified code is granted,
+-- provided the above notices are retained, and a notice that the code was
+-- modified is included with the above copyright notice.
+
+
+with "comfignat.gpr";
+
+library project Build_Testcase is
+
+ #if Frobnicate then
+ Frob_Flag := "-frob";
+ #else
+ Frob_Flag := "";
+ #end if;
+
+ for Library_Name use "testcase";
+ for Library_Kind use "dynamic";
+ for Library_Version use "libtestcase" & Frob_Flag & ".so.1";
+ for Library_Interface use ("Testcase");
+ for Source_Dirs use ($Srcdir);
+ for Object_Dir use Comfignat.Objdir;
+ for Library_Src_Dir use Comfignat.Stage_Includedir & "/testcase";
+ for Library_Dir use Comfignat.Stage_Libdir;
+ for Library_ALI_Dir use Comfignat.Stage_Alidir & "/testcase";
+
+end Build_Testcase;
diff --git a/testsuite/sources/library_1/generated_files b/testsuite/sources/library_1/generated_files
new file mode 100644
index 0000000..2acba75
--- /dev/null
+++ b/testsuite/sources/library_1/generated_files
@@ -0,0 +1,7 @@
+build_testcase.gpr
+comfignat.gpr
+${stage_includedir}/testcase/testcase.ads
+${stage_libdir}/libtestcase.so.1
+${stage_libdir}/libtestcase.so
+${stage_alidir}/testcase/testcase.ali
+${stage_gprdir}/testcase.gpr
diff --git a/testsuite/sources/library_1/testcase.adb b/testsuite/sources/library_1/testcase.adb
new file mode 100644
index 0000000..df96cc3
--- /dev/null
+++ b/testsuite/sources/library_1/testcase.adb
@@ -0,0 +1,24 @@
+-- part of Comfignat's testsuite
+-- Copyright 2014 B. Persson, Bjorn@Rombobeorn.se
+--
+-- This material is provided as is, with absolutely no warranty expressed
+-- or implied. Any use is at your own risk.
+--
+-- Permission is hereby granted to use or copy this testsuite
+-- for any purpose, provided the above notices are retained on all copies.
+-- Permission to modify the code and to distribute modified code is granted,
+-- provided the above notices are retained, and a notice that the code was
+-- modified is included with the above copyright notice.
+
+
+with Ada.Calendar; use Ada.Calendar;
+with Ada.Text_IO; use Ada.Text_IO;
+
+package body Testcase is
+
+ function Year return String is
+ begin
+ return Year(Clock)'Img;
+ end Year;
+
+end Testcase;
diff --git a/testsuite/sources/library_1/testcase.ads b/testsuite/sources/library_1/testcase.ads
new file mode 100644
index 0000000..d2646b8
--- /dev/null
+++ b/testsuite/sources/library_1/testcase.ads
@@ -0,0 +1,18 @@
+-- part of Comfignat's testsuite
+-- Copyright 2014 B. Persson, Bjorn@Rombobeorn.se
+--
+-- This material is provided as is, with absolutely no warranty expressed
+-- or implied. Any use is at your own risk.
+--
+-- Permission is hereby granted to use or copy this testsuite
+-- for any purpose, provided the above notices are retained on all copies.
+-- Permission to modify the code and to distribute modified code is granted,
+-- provided the above notices are retained, and a notice that the code was
+-- modified is included with the above copyright notice.
+
+
+package Testcase is
+
+ function Year return String;
+
+end Testcase;
diff --git a/testsuite/sources/library_1/testcase.gpr.gp b/testsuite/sources/library_1/testcase.gpr.gp
new file mode 100644
index 0000000..de4645c
--- /dev/null
+++ b/testsuite/sources/library_1/testcase.gpr.gp
@@ -0,0 +1,27 @@
+-- part of Comfignat's testsuite
+-- Copyright 2014 B. Persson, Bjorn@Rombobeorn.se
+--
+-- This material is provided as is, with absolutely no warranty expressed
+-- or implied. Any use is at your own risk.
+--
+-- Permission is hereby granted to use or copy this testsuite
+-- for any purpose, provided the above notices are retained on all copies.
+-- Permission to modify the code and to distribute modified code is granted,
+-- provided the above notices are retained, and a notice that the code was
+-- modified is included with the above copyright notice.
+
+
+#if Directories_GPR'Defined then
+with $Directories_GPR;
+#end if;
+
+library project Testcase is
+
+ for Library_Name use "testcase";
+ for Library_Kind use "dynamic";
+ for Source_Dirs use ($Includedir & "/testcase");
+ for Library_Dir use $Libdir;
+ for Library_ALI_Dir use $Alidir & "/testcase";
+ for Externally_Built use "true";
+
+end Testcase;