summaryrefslogtreecommitdiff
path: root/cesar/common/make/test
diff options
context:
space:
mode:
authorsave2008-04-07 14:17:42 +0000
committersave2008-04-07 14:17:42 +0000
commit3d58a62727346b7ac1a6cb36fed1a06ed72228dd (patch)
treed7788c3cf9f76426aef0286d0202e2097f0fa0eb /cesar/common/make/test
parent095dca4b0a8d4924093bab424f71f588fdd84613 (diff)
Moved the complete svn base into the cesar directory.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1769 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/common/make/test')
-rw-r--r--cesar/common/make/test/Config-output3
-rw-r--r--cesar/common/make/test/Config.alt-output8
-rw-r--r--cesar/common/make/test/b_shout.h-output6
-rw-r--r--cesar/common/make/test/clean-output12
-rw-r--r--cesar/common/make/test/ecos.ecc.sh-output5
-rw-r--r--cesar/common/make/test/first-output19
-rw-r--r--cesar/common/make/test/modules/a/Module2
-rw-r--r--cesar/common/make/test/modules/a/a.h23
-rw-r--r--cesar/common/make/test/modules/a/src/a.c25
-rw-r--r--cesar/common/make/test/modules/b/Config3
-rw-r--r--cesar/common/make/test/modules/b/Module1
-rw-r--r--cesar/common/make/test/modules/b/b.h26
-rw-r--r--cesar/common/make/test/modules/b/inc/b_shout.h18
-rw-r--r--cesar/common/make/test/modules/b/src/b_print.c33
-rw-r--r--cesar/common/make/test/modules/b/src/b_shout.c34
-rw-r--r--cesar/common/make/test/nothing-output1
-rw-r--r--cesar/common/make/test/project/Config2
-rw-r--r--cesar/common/make/test/project/Config.alt2
-rw-r--r--cesar/common/make/test/project/Makefile20
-rw-r--r--cesar/common/make/test/project/ecos.ecc.sh11
-rw-r--r--cesar/common/make/test/project/inc/test_make.h18
-rw-r--r--cesar/common/make/test/project/src/test_cpp.cpp27
-rw-r--r--cesar/common/make/test/project/src/test_make.c26
-rw-r--r--cesar/common/make/test/project_synth/Config1
-rw-r--r--cesar/common/make/test/project_synth/Makefile12
-rw-r--r--cesar/common/make/test/project_synth/ecos.ecc.sh5
-rw-r--r--cesar/common/make/test/project_synth/inc/test_make.h18
-rw-r--r--cesar/common/make/test/project_synth/src/test_make.c26
-rw-r--r--cesar/common/make/test/test_make.c-output5
-rw-r--r--cesar/common/make/test/test_make.h-output7
-rwxr-xr-xcesar/common/make/test/test_make.sh65
31 files changed, 464 insertions, 0 deletions
diff --git a/cesar/common/make/test/Config-output b/cesar/common/make/test/Config-output
new file mode 100644
index 0000000000..312d3bef5e
--- /dev/null
+++ b/cesar/common/make/test/Config-output
@@ -0,0 +1,3 @@
+CONF merge
+CONF headers
+MAKE ecos.all
diff --git a/cesar/common/make/test/Config.alt-output b/cesar/common/make/test/Config.alt-output
new file mode 100644
index 0000000000..5bbb668b24
--- /dev/null
+++ b/cesar/common/make/test/Config.alt-output
@@ -0,0 +1,8 @@
+CONF merge
+CONF headers
+CC [host] ../../../../common/make/test/modules/b/src/b_shout.c
+LINK [host] obj/test_make
+LDXX [host] obj/test_cpp
+CC [target] ../../../../common/make/test/modules/b/src/b_shout.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/b_shout.h-output b/cesar/common/make/test/b_shout.h-output
new file mode 100644
index 0000000000..f07242314c
--- /dev/null
+++ b/cesar/common/make/test/b_shout.h-output
@@ -0,0 +1,6 @@
+CC [host] ../../../../common/make/test/modules/b/src/b_shout.c
+LINK [host] obj/test_make
+LDXX [host] obj/test_cpp
+CC [target] ../../../../common/make/test/modules/b/src/b_shout.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/clean-output b/cesar/common/make/test/clean-output
new file mode 100644
index 0000000000..638c799cc1
--- /dev/null
+++ b/cesar/common/make/test/clean-output
@@ -0,0 +1,12 @@
+rm -f obj/Config.empty obj/Config.merged
+rm -rf obj/inc/config.h obj/inc/config
+rm -f obj/test_make obj/test_cpp obj/test_make_ecos.elf \
+rm -rf obj/ecos/tree.stamp obj/ecos/build
+rm -rf obj/ecos/headers.stamp obj/ecos/install
+rm -f obj/ecos/ecos.ecc obj/ecos/ecos-cov.ecc new-ecos.ecc
+if [ -d obj/ecos ]; then rmdir obj/ecos; fi
+rm -f obj/inc/dir.stamp obj/dir.stamp \
+
+rm -rf
+if [ -d obj/inc ]; then rmdir obj/inc; fi
+if [ -d obj ]; then rmdir obj; fi
diff --git a/cesar/common/make/test/ecos.ecc.sh-output b/cesar/common/make/test/ecos.ecc.sh-output
new file mode 100644
index 0000000000..fe4145120f
--- /dev/null
+++ b/cesar/common/make/test/ecos.ecc.sh-output
@@ -0,0 +1,5 @@
+ECOS conf
+ECOS tree
+MAKE ecos.defs
+MAKE ecos.headers
+MAKE ecos.all
diff --git a/cesar/common/make/test/first-output b/cesar/common/make/test/first-output
new file mode 100644
index 0000000000..dede1a43ea
--- /dev/null
+++ b/cesar/common/make/test/first-output
@@ -0,0 +1,19 @@
+ECOS conf
+ECOS tree
+MAKE ecos.defs
+CONF merge
+CONF headers
+CC [host] src/test_make.c
+CC [host] ../../../../common/make/test/modules/a/src/a.c
+CC [host] ../../../../common/make/test/modules/b/src/b_print.c
+CC [host] ../../../../common/make/test/modules/b/src/b_shout.c
+LINK [host] obj/test_make
+CXX [host] src/test_cpp.cpp
+LDXX [host] obj/test_cpp
+MAKE ecos.headers
+CC [target] src/test_make.c
+CC [target] ../../../../common/make/test/modules/a/src/a.c
+CC [target] ../../../../common/make/test/modules/b/src/b_print.c
+CC [target] ../../../../common/make/test/modules/b/src/b_shout.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/modules/a/Module b/cesar/common/make/test/modules/a/Module
new file mode 100644
index 0000000000..247658ae25
--- /dev/null
+++ b/cesar/common/make/test/modules/a/Module
@@ -0,0 +1,2 @@
+SOURCES := a.c
+MODULES := common/make/test/modules/b
diff --git a/cesar/common/make/test/modules/a/a.h b/cesar/common/make/test/modules/a/a.h
new file mode 100644
index 0000000000..843e51522b
--- /dev/null
+++ b/cesar/common/make/test/modules/a/a.h
@@ -0,0 +1,23 @@
+#ifndef a_h
+#define a_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file a.h
+ * \brief Test module header for build system tests.
+ * \ingroup test
+ */
+
+BEGIN_DECLS
+
+void
+a_print (void);
+
+END_DECLS
+
+#endif /* a_h */
diff --git a/cesar/common/make/test/modules/a/src/a.c b/cesar/common/make/test/modules/a/src/a.c
new file mode 100644
index 0000000000..9fa32f6ae7
--- /dev/null
+++ b/cesar/common/make/test/modules/a/src/a.c
@@ -0,0 +1,25 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file a.c
+ * \brief Test module for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "a.h"
+
+#include <stdio.h>
+
+/**
+ * Print module's deepest thought.
+ */
+void
+a_print (void)
+{
+ printf ("I am the a module!\n");
+}
diff --git a/cesar/common/make/test/modules/b/Config b/cesar/common/make/test/modules/b/Config
new file mode 100644
index 0000000000..860e294ba9
--- /dev/null
+++ b/cesar/common/make/test/modules/b/Config
@@ -0,0 +1,3 @@
+CONFIG_B_LISTEN_CAREFULLY = y
+CONFIG_B_SHOUT_TWICE = y
+CONFIG_B_REPEAT = 1
diff --git a/cesar/common/make/test/modules/b/Module b/cesar/common/make/test/modules/b/Module
new file mode 100644
index 0000000000..b52b97a009
--- /dev/null
+++ b/cesar/common/make/test/modules/b/Module
@@ -0,0 +1 @@
+SOURCES := b_print.c b_shout.c
diff --git a/cesar/common/make/test/modules/b/b.h b/cesar/common/make/test/modules/b/b.h
new file mode 100644
index 0000000000..4e0724428b
--- /dev/null
+++ b/cesar/common/make/test/modules/b/b.h
@@ -0,0 +1,26 @@
+#ifndef b_h
+#define b_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b.h
+ * \brief Test module header for build system tests.
+ * \ingroup test
+ */
+
+BEGIN_DECLS
+
+void
+b_print (void);
+
+void
+b_shout (void);
+
+END_DECLS
+
+#endif /* b_h */
diff --git a/cesar/common/make/test/modules/b/inc/b_shout.h b/cesar/common/make/test/modules/b/inc/b_shout.h
new file mode 100644
index 0000000000..9e80de10e3
--- /dev/null
+++ b/cesar/common/make/test/modules/b/inc/b_shout.h
@@ -0,0 +1,18 @@
+#ifndef b_shout_h
+#define b_shout_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b_shout.h
+ * \brief Test module private header for build system tests.
+ * \ingroup test
+ */
+
+#define B_SHOUT "I AM THE B MODULE!\n"
+
+#endif /* b_shout_h */
diff --git a/cesar/common/make/test/modules/b/src/b_print.c b/cesar/common/make/test/modules/b/src/b_print.c
new file mode 100644
index 0000000000..b3b5d2f2ea
--- /dev/null
+++ b/cesar/common/make/test/modules/b/src/b_print.c
@@ -0,0 +1,33 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b_print.c
+ * \brief Test module for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "b.h"
+
+#include "config/b/listen/carefully.h"
+#include "config/b/repeat.h"
+
+#include <stdio.h>
+
+/**
+ * Print module's deepest thought.
+ */
+void
+b_print (void)
+{
+#if CONFIG_B_LISTEN_CAREFULLY
+ printf ("please listen carefully (however, it is a stupid example):\n");
+#endif
+ uint i;
+ for (i = 0; i < CONFIG_B_REPEAT; i++)
+ printf ("I am the b module!\n");
+}
diff --git a/cesar/common/make/test/modules/b/src/b_shout.c b/cesar/common/make/test/modules/b/src/b_shout.c
new file mode 100644
index 0000000000..06472cf872
--- /dev/null
+++ b/cesar/common/make/test/modules/b/src/b_shout.c
@@ -0,0 +1,34 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b_shout.c
+ * \brief Test module for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "inc/b_shout.h"
+#include "b.h"
+
+#include "config/b.h"
+
+#include <stdio.h>
+
+/**
+ * Shout module's deepest thought.
+ */
+void
+b_shout (void)
+{
+#if CONFIG_B_LISTEN_CAREFULLY
+ printf ("please listen carefully (however, it is a stupid example):\n");
+#endif
+ printf (B_SHOUT);
+#if CONFIG_B_SHOUT_TWICE
+ printf (B_SHOUT);
+#endif
+}
diff --git a/cesar/common/make/test/nothing-output b/cesar/common/make/test/nothing-output
new file mode 100644
index 0000000000..ae63c9beb5
--- /dev/null
+++ b/cesar/common/make/test/nothing-output
@@ -0,0 +1 @@
+MAKE ecos.all
diff --git a/cesar/common/make/test/project/Config b/cesar/common/make/test/project/Config
new file mode 100644
index 0000000000..31dbc59855
--- /dev/null
+++ b/cesar/common/make/test/project/Config
@@ -0,0 +1,2 @@
+CONFIG_B_SHOUT_TWICE = n
+CONFIG_B_REPEAT = 3
diff --git a/cesar/common/make/test/project/Config.alt b/cesar/common/make/test/project/Config.alt
new file mode 100644
index 0000000000..b46399634a
--- /dev/null
+++ b/cesar/common/make/test/project/Config.alt
@@ -0,0 +1,2 @@
+CONFIG_B_SHOUT_TWICE = y
+CONFIG_B_REPEAT = 3
diff --git a/cesar/common/make/test/project/Makefile b/cesar/common/make/test/project/Makefile
new file mode 100644
index 0000000000..f247892fe9
--- /dev/null
+++ b/cesar/common/make/test/project/Makefile
@@ -0,0 +1,20 @@
+BASE = ../../../..
+
+ECOS = y
+TARGET = sparc
+
+# This is an extra include.
+INCLUDES = common/make/test
+
+HOST_PROGRAMS = test_make test_cpp
+test_make_SOURCES = test_make.c
+test_make_MODULES = lib common/make/test/modules/a
+
+test_cpp_SOURCES = test_cpp.cpp
+test_cpp_MODULES = lib common/make/test/modules/a common/make/test/modules/b
+
+TARGET_PROGRAMS = test_make_ecos
+test_make_ecos_SOURCES = test_make.c
+test_make_ecos_MODULES = lib common/make/test/modules/a
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/common/make/test/project/ecos.ecc.sh b/cesar/common/make/test/project/ecos.ecc.sh
new file mode 100644
index 0000000000..be98f3e872
--- /dev/null
+++ b/cesar/common/make/test/project/ecos.ecc.sh
@@ -0,0 +1,11 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new sparc_leon default
+cat >> $config <<EOF
+cdl_component CYGHWR_HAL_SPARC_FLAT {
+ user_value 1
+}
+cdl_component CYGPKG_HAL_SPARC_REGISTER_WINDOWS {
+ user_value 2
+}
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/common/make/test/project/inc/test_make.h b/cesar/common/make/test/project/inc/test_make.h
new file mode 100644
index 0000000000..acbf024439
--- /dev/null
+++ b/cesar/common/make/test/project/inc/test_make.h
@@ -0,0 +1,18 @@
+#ifndef test_make_h
+#define test_make_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.h
+ * \brief Test program header for build system tests.
+ * \ingroup test
+ */
+
+#define TEST_MAKE_EXIT 0
+
+#endif /* test_make_h */
diff --git a/cesar/common/make/test/project/src/test_cpp.cpp b/cesar/common/make/test/project/src/test_cpp.cpp
new file mode 100644
index 0000000000..a514ab66e0
--- /dev/null
+++ b/cesar/common/make/test/project/src/test_cpp.cpp
@@ -0,0 +1,27 @@
+// Cesar project {{{
+//
+// Copyright (C) 2007 Spidcom
+//
+// <<<Licence>>>
+//
+// }}}
+/// \file test_cpp.cpp
+/// \brief Test c++ program for build system tests.
+/// \ingroup test
+#include "common/std.h"
+#include "inc/test_make.h"
+
+#include "modules/a/a.h"
+#include "modules/b/b.h"
+
+#include <iostream>
+
+int
+main (void)
+{
+ std::cout << "I am a c++ program" << std::endl;
+ a_print ();
+ b_print ();
+ b_shout ();
+ return TEST_MAKE_EXIT;
+}
diff --git a/cesar/common/make/test/project/src/test_make.c b/cesar/common/make/test/project/src/test_make.c
new file mode 100644
index 0000000000..faf947c5b2
--- /dev/null
+++ b/cesar/common/make/test/project/src/test_make.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.c
+ * \brief Test program for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "inc/test_make.h"
+
+#include "modules/a/a.h"
+#include "modules/b/b.h"
+
+int
+main (void)
+{
+ a_print ();
+ b_print ();
+ b_shout ();
+ return TEST_MAKE_EXIT;
+}
diff --git a/cesar/common/make/test/project_synth/Config b/cesar/common/make/test/project_synth/Config
new file mode 100644
index 0000000000..0fde81207e
--- /dev/null
+++ b/cesar/common/make/test/project_synth/Config
@@ -0,0 +1 @@
+CONFIG_B_SHOUT_TWICE = n
diff --git a/cesar/common/make/test/project_synth/Makefile b/cesar/common/make/test/project_synth/Makefile
new file mode 100644
index 0000000000..cdc62ac448
--- /dev/null
+++ b/cesar/common/make/test/project_synth/Makefile
@@ -0,0 +1,12 @@
+BASE = ../../../..
+
+ECOS = y
+
+# This is an extra include.
+INCLUDES = common/make/test
+
+TARGET_PROGRAMS = test_ecos_synth
+test_ecos_synth_SOURCES = test_make.c
+test_ecos_synth_MODULES = lib common/make/test/modules/a
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/common/make/test/project_synth/ecos.ecc.sh b/cesar/common/make/test/project_synth/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/common/make/test/project_synth/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/common/make/test/project_synth/inc/test_make.h b/cesar/common/make/test/project_synth/inc/test_make.h
new file mode 100644
index 0000000000..acbf024439
--- /dev/null
+++ b/cesar/common/make/test/project_synth/inc/test_make.h
@@ -0,0 +1,18 @@
+#ifndef test_make_h
+#define test_make_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.h
+ * \brief Test program header for build system tests.
+ * \ingroup test
+ */
+
+#define TEST_MAKE_EXIT 0
+
+#endif /* test_make_h */
diff --git a/cesar/common/make/test/project_synth/src/test_make.c b/cesar/common/make/test/project_synth/src/test_make.c
new file mode 100644
index 0000000000..faf947c5b2
--- /dev/null
+++ b/cesar/common/make/test/project_synth/src/test_make.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.c
+ * \brief Test program for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "inc/test_make.h"
+
+#include "modules/a/a.h"
+#include "modules/b/b.h"
+
+int
+main (void)
+{
+ a_print ();
+ b_print ();
+ b_shout ();
+ return TEST_MAKE_EXIT;
+}
diff --git a/cesar/common/make/test/test_make.c-output b/cesar/common/make/test/test_make.c-output
new file mode 100644
index 0000000000..e3b5060376
--- /dev/null
+++ b/cesar/common/make/test/test_make.c-output
@@ -0,0 +1,5 @@
+CC [host] src/test_make.c
+LINK [host] obj/test_make
+CC [target] src/test_make.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/test_make.h-output b/cesar/common/make/test/test_make.h-output
new file mode 100644
index 0000000000..ef51e5aa92
--- /dev/null
+++ b/cesar/common/make/test/test_make.h-output
@@ -0,0 +1,7 @@
+CC [host] src/test_make.c
+LINK [host] obj/test_make
+CXX [host] src/test_cpp.cpp
+LDXX [host] obj/test_cpp
+CC [target] src/test_make.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/test_make.sh b/cesar/common/make/test/test_make.sh
new file mode 100755
index 0000000000..330943f6d2
--- /dev/null
+++ b/cesar/common/make/test/test_make.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+tmp=make.log
+
+function failure () {
+ echo FAIL >&2
+ exit 1
+}
+
+trap failure ERR
+
+function runmake () {
+ t=$1
+ shift
+ echo "$t: make $*"
+ sleep 1
+ make -C project "$@" &> "$tmp"
+ sleep 1
+}
+function grepcap () {
+ grep '^[[:upper:]]\{2,\} ' | grep -v '\.\./lib/'
+}
+
+if [[ "$1" = quick ]]
+then
+ make -C project &> /dev/null
+else
+ make -C project clean &> /dev/null
+
+ runmake first
+ grepcap < "$tmp" | diff - first-output
+fi
+
+touch project/inc/test_make.h
+runmake test_make.h
+grepcap < "$tmp" | diff - test_make.h-output
+
+touch project/ecos.ecc.sh
+runmake ecos.ecc.sh
+grepcap < "$tmp" | diff - ecos.ecc.sh-output
+
+touch project/src/test_make.c
+runmake test_make.c
+grepcap < "$tmp" | diff - test_make.c-output
+
+runmake nothing
+grepcap < "$tmp" | diff - nothing-output
+
+touch modules/b/inc/b_shout.h
+runmake b_shout.h
+grepcap < "$tmp" | diff - b_shout.h-output
+
+touch project/Config
+runmake Config
+grepcap < "$tmp" | diff - Config-output
+
+touch project/Config.alt
+runmake Config.alt PROJECT_CONFIG=Config.alt
+grepcap < "$tmp" | diff - Config.alt-output
+
+runmake clean clean
+grep -v 'make:' < "$tmp" | grep -v ' obj/' | diff - clean-output
+
+rm -f "$tmp"
+echo PASS