-wvtest_SCRIPTS = bin_scripts.sh all_omk_subdirs.inc \
-all_omk_subdirs-recurs-expanded all_omk_subdirs-simply-expanded \
-automatic_subdirs bin_scripts.sh cmetric default-config \
-extra_rules_subdirs header-files headers-generated \
+wvtest_SCRIPTS = bin_scripts.sh all_omk_subdirs-recurs-expanded \
+all_omk_subdirs-simply-expanded automatic_subdirs cmetric \
+default-config extra_rules_subdirs header-files headers-generated \
headers-generated-default-cflags headers-nonexisting hooks \
ignore_errors includes invocation_dir libraries no-print-directory \
no_vpath omk_config override-config parallel_make programs \
RULES=$(shell cd ../rules; ls)
run-%: %
- for i in $(RULES); do OMK_RULES=$$i ./$* || break; done
+ for i in $(RULES); do OMK_RULES=$$i ./$* || exit 1; done
#!/bin/bash
+. ./functions.sh
+
OP="="
-. ./all_omk_subdirs.inc
+. "$OMK_TESTSROOT/all_omk_subdirs.inc"
--- /dev/null
+all_omk_subdirs.files
\ No newline at end of file
-#!/bin/bash\r
-\r
-OP=":="\r
-. ./all_omk_subdirs.inc\r
+#!/bin/bash
+
+. ./functions.sh
+
+OP=":="
+. "$OMK_TESTSROOT/all_omk_subdirs.inc"
--- /dev/null
+all_omk_subdirs.files
\ No newline at end of file
#!/bin/bash
-. ./functions.sh
-
touch config.omk-default
echo "SUBDIRS $OP \$(ALL_OMK_SUBDIRS)" > Makefile.omk
-
-OUTPUT=$(make 2>&1) || canttest
-echo $OUTPUT | grep make-in-dir1 || error "Make was not called in dir1"
-echo $OUTPUT | grep make-in-dir2 || error "Make was not called in dir2"
-echo $OUTPUT | grep make-in-dir3 && error "Make shouldn't be called in dir3"
+WVPASS bash -o pipefail -c 'make 2>&1 | tee output'
+grep make-in-dir1 output || error "Make was not called in dir1"
+grep make-in-dir2 output || error "Make was not called in dir2"
+grep make-in-dir3 output && error "Make shouldn't be called in dir3"
exit 0
-#!/bin/bash\r
-\r
-. ./functions.sh\r
-\r
-touch config.omk-default\r
-\r
-OUTPUT=$(make 2>&1) || canttest\r
-echo $OUTPUT | grep make-in-dir1 || error "Make was not called in dir1" \r
-echo $OUTPUT | grep make-in-dir2 || error "Make was not called in dir2"\r
-echo $OUTPUT | grep make-in-dir3 && error "Make shouldn't be called in dir3" \r
-\r
-exit 0\r
+#!/bin/bash
+
+. ./functions.sh
+
+touch config.omk-default
+
+OUTPUT=$(make 2>&1) || canttest
+echo $OUTPUT | grep make-in-dir1 || error "Make was not called in dir1"
+echo $OUTPUT | grep make-in-dir2 || error "Make was not called in dir2"
+echo $OUTPUT | grep make-in-dir3 && error "Make shouldn't be called in dir3"
+
+exit 0
. ./functions.sh
touch config.omk-default
+needs_valid_CC
+
make NM=false && error "cmetric error was not correctly detected"
make || error "compilation error"
cmp correct_cmetric_config.h _compiled/include/test/cmetric_config.h || \
#!/bin/bash
-make || exit 2
-echo "Default config differs" > _error
-diff -u config.omk-correct config.omk-default || exit 1
+
+. ./functions.sh
+
+WVPASS make
+WVPASS diff -u config.omk-correct config.omk-default
return 0;
}
EOF
-cat > 'subdir2/tools/Makefile.omk' <<EOF
+cat > 'subdir2/tools/Makefile.omk' <<'EOF'
$(info Extra rules goal: $(MAKECMDGOALS))
bin_PROGRAMS = test
EOF
echo 'SUBDIRS=subdir subdir2' > 'Makefile.omk'
mkdir 'subdir'
-cat > 'subdir/Makefile.omk' <<EOF
+cat > 'subdir/Makefile.omk' <<'EOF'
$(info Main rules goal: $(MAKECMDGOALS))
EOF
# Exit on the first error
set -e
-WVSTART "$(basename $0 .sh)"
-WVPASS . ../$(basename $0 .sh).files
+WVPASS . ../../$(basename $0 .sh).files
omkize
findup() {
_wvfind_caller
_wvcheck 1 "$1 (cannot be test)"
}
-
mkdir 'orte'
-cat > 'orte/orte_config_omk_win32.h' <<EOF
+cat > 'orte/orte_config_omk_win32.h' <<'EOF'
/* orte/include/orte/orte_config.h. Generated by configure. */
/* orte/include/orte/orte_config.h.in. Generated from configure.in by autoheader. */
/* #undef inline */
#endif
EOF
-cat > 'ls-include.txt' <<EOF
+cat > 'ls-include.txt' <<'EOF'
.:
orte
periph
./periph:
sci_channels.h
EOF
-cat > 'Makefile.omk' <<EOF
+cat > 'Makefile.omk' <<'EOF'
include_HEADERS = x.h periph/sci_regs.h
nobase_include_HEADERS = periph/sci_channels.h
renamed_include_HEADERS = x.h->y.h
EOF
echo '// Hello' > 'x.h'
mkdir 'periph'
-cat > 'periph/sci_regs.h' <<EOF
+cat > 'periph/sci_regs.h' <<'EOF'
/*******************************************************************
Components for embedded applications builded for
laboratory and medical instruments firmware
#endif /* _SCI_REGS_H */
EOF
-cat > 'periph/sci_channels.h' <<EOF
+cat > 'periph/sci_channels.h' <<'EOF'
/*******************************************************************
Components for embedded applications builded for
laboratory and medical instruments firmware
grep -Fv "/* config files:" $GC | diff -u correct/global.h - || error "Global config differs"
+needs_valid_CC
+
make || error "Can't run make to produce local config"
make CFLAGS=-Wall || error "Make failed with custom CFLAGS"
LC=$(find _build -wholename '*/lincan/lincan_config.h')
make default-config || error default-config
make distclean
+
+needs_valid_CC
+
LC_MESSAGES=C
export LC_MESSAGES
set -o pipefail
--- /dev/null
+headers-generated.files
\ No newline at end of file
mkdir 'correct'
-cat > 'correct/global.h' <<EOF
+cat > 'correct/global.h' <<'EOF'
/* Automatically generated from */
#ifndef _global_H
#define _global_H
#define CONFIG_TEST_APOS "Text+apostrophes"
#endif /* _global_H */
EOF
-cat > 'correct/toplevel_config.h' <<EOF
+cat > 'correct/toplevel_config.h' <<'EOF'
/* Automatically generated from */
#ifndef _LOCAL_CONFIG_H
#define _LOCAL_CONFIG_H
#define CONFIG_OC_LINCAN 1
#endif /*_LOCAL_CONFIG_H*/
EOF
-cat > 'correct/lincan_config.h' <<EOF
+cat > 'correct/lincan_config.h' <<'EOF'
/* Automatically generated from */
#ifndef _LOCAL_CONFIG_H
#define _LOCAL_CONFIG_H
#define CONFIG_OC_LINCAN_CARD_template 1
#endif /*_LOCAL_CONFIG_H*/
EOF
-cat > 'config.omk-default' <<EOF
+cat > 'config.omk-default' <<'EOF'
# Start of OMK config file
# This file should not be altered manually
# Overrides should be stored in file config.omk
#CONFIG_OC_LINCAN=x
#CONFIG_UNKNOWN=x
EOF
-cat > 'Makefile.omk' <<EOF
+cat > 'Makefile.omk' <<'EOF'
SUBDIRS=lincan
default_CONFIG = CONFIG_TEST_NUM=123 CONFIG_TEST_STR=Hello
CONFIG_TEST_NUM CONFIG_TEST_STR CONFIG_TEST_APOS
EOF
mkdir 'lincan'
-cat > 'lincan/configtest.c' <<EOF
+cat > 'lincan/configtest.c' <<'EOF'
#include "lincan_config.h"
int main(void)
/* With default CFLAGS a warning should be produced: control reaches end of non-void function */
}
EOF
-cat > 'lincan/Makefile.omk' <<EOF
+cat > 'lincan/Makefile.omk' <<'EOF'
lincan_cards_NAMES = pip pccan smartcan nsi cc_can104 ems_cpcpci \
pc_i03 pcm3680 aim104 m437 pcccan ssv bfadcan gensja1000io pikronisa eb8245 \
kv_pcican msmcan oscar adlink7841 unican virtual template
echo '' > 'config.omk-default'
-cat > 'Makefile.omk' <<EOF
+cat > 'Makefile.omk' <<'EOF'
include-pass_HOOKS=include-pass-hook
library-pass_HOOKS=library-pass-hook
binary-pass_HOOKS=binary-pass-hook
#!/bin/bash
+. ./functions.sh
+
touch config.omk-default
-make
+needs_valid_CC
+WVPASS make
-cat > 'test.c' <<EOF
+cat > 'test.c' <<'EOF'
#include <stdio.h>
#include <mynumber.h>
int main()
return 0;
}
EOF
-cat > 'Makefile.omk' <<EOF
+cat > 'Makefile.omk' <<'EOF'
bin_PROGRAMS = test
test_SOURCES = test.c
#!/bin/bash
+. ./functions.sh
+
touch config.omk-default
-make
+needs_valid_CC
+WVPASS make
. ./functions.sh
touch config.omk-default
+needs_valid_CC
make 2>/dev/null|grep "Entering directory.*_build" && error "Entering directory message should be suppressed"
make distclean
make V=2 2>/dev/null|grep 'Entering directory.*_build' || error "Entering directory message didn't appear"
#!/bin/bash
. ./functions.sh
-
+needs_valid_CC
make || error ".o files should not be searched in SOURCES_DIR"
. ./functions.sh
touch config.omk-default
+needs_valid_CC
make
touch config.omk-default
echo "CFLAGS=-DNUMBER=123" > config.omk
+needs_valid_CC
make||error "Can't compile"
[ $OMK_RULES != linux ] && canttest "Should work only with Linux rules"
_compiled/bin/test|grep 123 || error "Custom CFLAGS didn't influence the output"
. ./functions.sh
touch config.omk-default
+needs_valid_CC
make CFLAGS="-DNONSENSE=abc -DNUMBER=123"||error "Can't compile"
[ $OMK_RULES != linux ] && canttest "Should work only with Linux rules"
_compiled/bin/test|grep 123 || error "Custom CFLAGS didn't influence the output"
--- /dev/null
+programs.files
\ No newline at end of file
--- /dev/null
+programs.files
\ No newline at end of file
touch config.omk-default
echo "DEFS=-DNUMBER=123" > config.omk
+needs_valid_CC
make||error "Can't compile"
[ $OMK_RULES != linux ] && canttest "Should work only with Linux rules"
_compiled/bin/test|grep 123 || error "Variable DEFS didn't influence the output"
--- /dev/null
+programs.files
\ No newline at end of file
touch config.omk-default
rm -rf _compiled
+needs_valid_CC
make MAKEFILE_OMK=Makefile.omk-test_PROGRAMS || error make
FOUND=`find _compiled -wholename '*/bin-tests/test*'`
echo "Found: $FOUND"
--- /dev/null
+programs.files
\ No newline at end of file
-cat > 'Makefile.omk-test_PROGRAMS' <<EOF
+cat > 'Makefile.omk-test_PROGRAMS' <<'EOF'
test_PROGRAMS = test
-test_SOURCES = test.cEOF
-cat > 'test.c' <<EOF
+test_SOURCES = test.c
+EOF
+cat > 'test.c' <<'EOF'
#include <stdio.h>
int main()
return 0;
}
EOF
-cat > 'Makefile.omk' <<EOF
+cat > 'Makefile.omk' <<'EOF'
bin_PROGRAMS = test
-test_SOURCES = test.cEOF
+test_SOURCES = test.c
+EOF
#!/bin/bash
+[[ $OMK_RULES != linux ]] && exit 0
+
. ./functions.sh
touch config.omk-default
#!/bin/bash
+[[ $OMK_RULES != linux ]] && exit 0
+
. ./functions.sh
touch config.omk-default
--- /dev/null
+qt.files
\ No newline at end of file
echo 'SUBDIRS = somelib qtapp' > 'Makefile3.omk'
-cat > 'Makefile2.omk' <<EOF
+cat > 'Makefile2.omk' <<'EOF'
SUBDIRS = somelib dir
EOF
-cat > 'Makefile.omk' <<EOF
+cat > 'Makefile.omk' <<'EOF'
SUBDIRS = somelib
QT_SUBDIRS = qtapp
EOF
-cat > 'test.inc' <<EOF
+cat > 'test.inc' <<'EOF'
cp Makefile1.omk Makefile.omk
make || error "QT compilation"
[ -x _compiled/bin/qtapp ] || error "QT application was not compiled"
make clean || error "QT clean 3"
EOF
mkdir 'somelib'
-cat > 'somelib/somelib.c' <<EOF
+cat > 'somelib/somelib.c' <<'EOF'
#include <header.h>
int some_function(int num)
return SOME_CONST - num;
}
EOF
-cat > 'somelib/Makefile.omk' <<EOF
+cat > 'somelib/Makefile.omk' <<'EOF'
include_HEADERS = header.h
shared_LIBRARIES = somelib
somelib_SOURCES = somelib.c
EOF
-cat > 'somelib/header.h' <<EOF
+cat > 'somelib/header.h' <<'EOF'
#ifndef HEADER_H
#define HEADER_H
mkdir 'dir'
echo 'QT_SUBDIRS = ../qtapp' > 'dir/Makefile.omk'
mkdir 'qtapp'
-cat > 'qtapp/qtapp.cxx' <<EOF
+cat > 'qtapp/qtapp.cxx' <<'EOF'
#include <QApplication>
#include <QPushButton>
#include <header.h>
}
EOF
echo 'QT_PROJECTS=qtapp.pro' > 'qtapp/Makefile.omk'
-cat > 'qtapp/qtapp.pro' <<EOF
+cat > 'qtapp/qtapp.pro' <<'EOF'
######################################################################
# Automatically generated by qmake (2.01a) po ?rc 16 18:49:31 2007
######################################################################
# Input
SOURCES += qtapp.cxx
-LIBS+=-lsomelibEOF
-cat > 'Makefile1.omk' <<EOF
+LIBS+=-lsomelib
+EOF
+cat > 'Makefile1.omk' <<'EOF'
SUBDIRS = somelib
QT_SUBDIRS = qtapp
EOF
#!/bin/bash
+case $OMK_RULES in
+ sdcc|rtems|sysless-keil51|sysless-keil16x)
+ exit 0;;
+esac
+
+. ./functions.sh
+
touch config.omk-default
-make
+WVPASS make
. ./functions.sh
+case $OMK_RULES in
+ linux|sysless)
+ ;;
+ *) exit 0
+esac
+
touch config.omk-default
mkdir dir
cd dir
--- /dev/null
+subdirs_first.files
\ No newline at end of file
mkdir 'dir1'
-cat > 'dir1/Makefile.omk' <<EOF
+cat > 'dir1/Makefile.omk' <<'EOF'
SUBDIRS=dir3
USE_LEAF_MAKEFILES=n
EOF
mkdir 'dir1/dir3'
echo '$(warning Makefile.omk used without leaf Makefile)' > 'dir1/dir3/Makefile.omk'
-cat > 'config.omk-default' <<EOF
+cat > 'config.omk-default' <<'EOF'
# Start of OMK config file
# This file should not be altered manually
# Overrides should be stored in file config.omk
mkdir 'dir2'
echo 'SUBDIRS=dir4' > 'dir2/Makefile.omk'
mkdir 'dir2/dir4'
-cat > 'dir2/dir4/Makefile' <<EOF
+cat > 'dir2/dir4/Makefile' <<'EOF'
$(warning Leaf Makefile included)
%:
#!/bin/bash
+[[ $OMK_RULES != wxworks ]] && exit 0
+
touch config.omk-default
make
rm -f *.mark
-make -C subdir W=1
+WVPASS make -C subdir W=1
[ -f 'toplevel.mark' ] || error "Toplevel make was not called".
[ `wc -l < subdir.mark` -eq 1 ] || error "OMK_SERIALIZE does not work"
echo '' > 'config.omk-default'
-cat > 'Makefile.omk' <<EOF
+cat > 'Makefile.omk' <<'EOF'
$(shell echo "Top-level executed" > toplevel.mark)
SUBDIRS=subdir
-
EOF
-mkdir 'subdir'
-cat > 'subdir/Makefile.omk' <<EOF
+mkdir subdir
+cat > 'subdir/Makefile.omk' <<'EOF'
include-pass_HOOKS=include-pass-test
include-pass-test:
omkize()
{
WVPASS cp "$OMK_TESTSROOT/../leaf-makefile/Makefile" .
- WVPASS make omkize
+ for i in `find -L . -mindepth 2 -name Makefile.omk`; do
+ d=`dirname ${i}`
+ WVPASS cp Makefile "${d}/Makefile"
+ done
+}
+
+needs_valid_CC()
+{
+ CC=$(make -qp|sed -ne '/^CC = / s///p')
+ if ! [[ -x "$CC" ]]; then
+ echo "Warning: $CC not found - skipping the test"
+ exit 0
+ fi
}
OMK_TESTSROOT=${OMK_TESTSROOT:-$(readlink --canonicalize $(dirname $0))}
OMK_RULES=${OMK_RULES:-linux} # When run manually, we use linux rules
-testdir="tmp.$(basename $0 .sh)"
+
+case $OMK_RULES in
+ rtems)
+ [[ -z "$RTEMS_MAKEFILE_PATH" ]] && exit 0
+ ;;
+ vxworks)
+ [[ -z "$WRENV" ]] && exit 0
+ ;;
+esac
+
+echo "Testing \"$OMK_RULES rules\" in $(basename $0):" >&2
+testdir="tmp/$(basename $0 .sh).$OMK_RULES"
[ -d "$testdir" ] && WVPASS rm -rf "$testdir"
-WVPASS mkdir "$testdir"
+WVPASS mkdir -p "$testdir"
WVPASS cd "$testdir"
WVPASS cp "$OMK_TESTSROOT"/../rules/$OMK_RULES/* .