]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Simplify CFLAGS test and check for CFLAGS overriding AM_CFLAGS
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 09:20:49 +0000 (10:20 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 10:31:34 +0000 (11:31 +0100)
tests/Makefile
tests/programs-cflags
tests/programs-cflags-cmdline [deleted file]
tests/programs-cflags-cmdline.files [deleted symlink]
tests/programs-cflags.files [deleted symlink]

index 7552fb2caa37c221df2d835ea9d7973ce3ec969d..93aa1236f78ac979357f754424edf8cc7406b7e6 100644 (file)
@@ -4,7 +4,7 @@ default-config extra_rules_subdirs header-files headers-generated       \
 headers-generated-default-cflags headers-nonexisting hooks             \
 idl ignore_errors includes invocation_dir libraries no-print-directory \
 no_vpath omk_config override-config parallel_make programs             \
-programs-cflags programs-cxxflags programs-cflags-cmdline programs-defs        \
+programs-cflags programs-cxxflags programs-defs        \
 programs-test_PROGRAMS qt qt-qmake shlibs sources_dir                  \
 sources_in_subdirectory sources_list subdirs_first                     \
 subdirs_first-force-subdir use_leaf_makefiles vxworks whole_tree omkize
index 90960ec9e96a17e67ccdf7efe1678945817e2580..744bd9a91fd30c9f3c835b7d79b82518b458b391 100755 (executable)
@@ -1,12 +1,48 @@
 #!/bin/bash
 
-. ./functions.sh
+. ./wvtest.sh
 
-touch config.omk-default
-echo "CFLAGS=-DNUMBER=123" > config.omk
+create_files() {
+    cat > 'test.c' <<'EOF'
+#include <stdio.h>
+
+int main()
+{
+#ifdef NUMBER
+        printf("NUMBER is %d\n", NUMBER);
+#endif
+        return 0;
+}
+EOF
+    cat > 'Makefile.omk' <<'EOF'
+bin_PROGRAMS = test
+test_SOURCES = test.c
+EOF
+}
+
+grepout() {
+    if [ $OMK_RULES = linux ]; then
+       # The following should work only with Linux rules
+       _compiled/bin/test|grep $@
+    fi
+}
+
+set -o pipefail
+
+WVSTART "AM_CFLAGS"
+create_files
 needs_valid_CC
-make||error "Can't compile"
-if [ $OMK_RULES = linux ]; then
-    # The following should work only with Linux rules
-    _compiled/bin/test|grep 123 || error "Custom CFLAGS didn't influence the output"
-fi
+WVPASS make AM_CFLAGS=-DNUMBER=123
+WVPASS grepout 123
+
+WVSTART "CFLAGS override AM_CFLAGS"
+create_files
+WVPASS make AM_CFLAGS=-DNUMBER=123 CFLAGS=-DNUMBER=321
+WVPASS grepout 321
+
+
+WVSTART "AM_CFLAGS in config.omk"
+create_files
+echo "AM_CFLAGS=-DNUMBER=123" > config.omk
+WVPASS make
+WVPASS grepout 123
diff --git a/tests/programs-cflags-cmdline b/tests/programs-cflags-cmdline
deleted file mode 100755 (executable)
index ddeda49..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-. ./functions.sh
-
-touch config.omk-default
-needs_valid_CC
-make CFLAGS="-DNONSENSE=abc -DNUMBER=123"||error "Can't compile"
-if [ $OMK_RULES = linux ]; then
-    # The following should work only with Linux rules
-    _compiled/bin/test|grep 123 || error "Custom CFLAGS didn't influence the output"
-fi
diff --git a/tests/programs-cflags-cmdline.files b/tests/programs-cflags-cmdline.files
deleted file mode 120000 (symlink)
index 73e4eca..0000000
+++ /dev/null
@@ -1 +0,0 @@
-programs.files
\ No newline at end of file
diff --git a/tests/programs-cflags.files b/tests/programs-cflags.files
deleted file mode 120000 (symlink)
index 73e4eca..0000000
+++ /dev/null
@@ -1 +0,0 @@
-programs.files
\ No newline at end of file