From 526e8a9dce8fd7477f0e88e17803b516868d9638 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 20 Jan 2007 10:08:00 +0000 Subject: [PATCH] Added some testcases. Minor bugfixes for runtests.py. darcs-hash:20070120100823-f2ef6-7774b189fa77b3ae1d20f281e7af33e9cc50554e.gz --- tests/README.tests | 5 +- tests/config/default/Makefile | 14 + tests/config/default/Makefile.omk | 4 + tests/config/default/config.omk-correct | 12 + tests/config/default/runtest | 4 + tests/config/default/subdir/Makefile | 14 + tests/config/default/subdir/Makefile.omk | 1 + tests/functions.sh | 9 + tests/headers/files/Makefile | 14 + tests/headers/files/Makefile.omk | 4 + tests/headers/files/ls-include.txt | 12 + .../files/orte/orte_config_omk_win32.h | 243 ++++++++++++++++++ tests/headers/files/periph/sci_channels.h | 37 +++ tests/headers/files/periph/sci_regs.h | 33 +++ tests/headers/files/rules | 1 + tests/headers/files/runtest | 10 + tests/headers/files/x.h | 1 + tests/headers/generated/Makefile | 14 + tests/headers/generated/Makefile.omk | 9 + tests/headers/generated/config.omk-default | 43 ++++ tests/headers/generated/correct/global.h | 7 + .../headers/generated/correct/lincan_config.h | 29 +++ tests/headers/generated/lincan/Makefile | 14 + tests/headers/generated/lincan/Makefile.omk | 18 ++ tests/headers/generated/lincan/configtest.c | 2 + tests/headers/generated/runtest | 17 ++ tests/runtests.py | 20 +- tests/vxworks/Makefile | 14 + tests/vxworks/Makefile.omk | 1 + tests/vxworks/rules | 1 + 30 files changed, 597 insertions(+), 10 deletions(-) create mode 100644 tests/config/default/Makefile create mode 100644 tests/config/default/Makefile.omk create mode 100644 tests/config/default/config.omk-correct create mode 100755 tests/config/default/runtest create mode 100644 tests/config/default/subdir/Makefile create mode 100644 tests/config/default/subdir/Makefile.omk create mode 100644 tests/headers/files/Makefile create mode 100644 tests/headers/files/Makefile.omk create mode 100644 tests/headers/files/ls-include.txt create mode 100644 tests/headers/files/orte/orte_config_omk_win32.h create mode 100644 tests/headers/files/periph/sci_channels.h create mode 100644 tests/headers/files/periph/sci_regs.h create mode 100644 tests/headers/files/rules create mode 100755 tests/headers/files/runtest create mode 100644 tests/headers/files/x.h create mode 100644 tests/headers/generated/Makefile create mode 100644 tests/headers/generated/Makefile.omk create mode 100644 tests/headers/generated/config.omk-default create mode 100644 tests/headers/generated/correct/global.h create mode 100644 tests/headers/generated/correct/lincan_config.h create mode 100644 tests/headers/generated/lincan/Makefile create mode 100644 tests/headers/generated/lincan/Makefile.omk create mode 100644 tests/headers/generated/lincan/configtest.c create mode 100755 tests/headers/generated/runtest create mode 100644 tests/vxworks/Makefile create mode 100644 tests/vxworks/Makefile.omk create mode 100644 tests/vxworks/rules diff --git a/tests/README.tests b/tests/README.tests index 469f1e6..b2eb387 100644 --- a/tests/README.tests +++ b/tests/README.tests @@ -21,7 +21,8 @@ files: Makefile.test, runtest. * Testcase Execution: Runtest is executed with OMK_RULES environment variable set to the - name of the actual rules tested. + name of the actual rules tested and OMK_TESTSROOT to the directory + containing the runtests.py script. * Testcase Output: @@ -56,7 +57,7 @@ The rules file contains one line of one of the following forms: * snip: - this selects all the rules, which contain the given snippet. -* python: - The python expression is evaluated. The +* python: - The python expression is evaluated. The global namespace contains the following variables: - rules: the name of tested rules diff --git a/tests/config/default/Makefile b/tests/config/default/Makefile new file mode 100644 index 0000000..f595272 --- /dev/null +++ b/tests/config/default/Makefile @@ -0,0 +1,14 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + diff --git a/tests/config/default/Makefile.omk b/tests/config/default/Makefile.omk new file mode 100644 index 0000000..371902e --- /dev/null +++ b/tests/config/default/Makefile.omk @@ -0,0 +1,4 @@ +default_CONFIG = CONFIG_OC_LINCAN=y CONFIG_OC_LINCANRTL=n CONFIG_OC_LINCANVME=n +default_CONFIG += CONFIG_OC_LINCAN_PORTIO_ONLY=n CONFIG_OC_LINCAN_MEMIO_ONLY=n + +SUBDIRS=subdir \ No newline at end of file diff --git a/tests/config/default/config.omk-correct b/tests/config/default/config.omk-correct new file mode 100644 index 0000000..0a2a2d3 --- /dev/null +++ b/tests/config/default/config.omk-correct @@ -0,0 +1,12 @@ +# Start of OMK config file +# This file should not be altered manually +# Overrides should be stored in file config.omk + +# Config for subdir +CONFIG_SUBDIR=y +# Config for +CONFIG_OC_LINCAN=y +CONFIG_OC_LINCANRTL=n +CONFIG_OC_LINCANVME=n +CONFIG_OC_LINCAN_PORTIO_ONLY=n +CONFIG_OC_LINCAN_MEMIO_ONLY=n diff --git a/tests/config/default/runtest b/tests/config/default/runtest new file mode 100755 index 0000000..0e64e40 --- /dev/null +++ b/tests/config/default/runtest @@ -0,0 +1,4 @@ +#!/bin/sh +make default-config || exit 2 +echo "Default config differs" > _error +diff -u config.omk-correct config.omk-default || exit 1 \ No newline at end of file diff --git a/tests/config/default/subdir/Makefile b/tests/config/default/subdir/Makefile new file mode 100644 index 0000000..f595272 --- /dev/null +++ b/tests/config/default/subdir/Makefile @@ -0,0 +1,14 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + diff --git a/tests/config/default/subdir/Makefile.omk b/tests/config/default/subdir/Makefile.omk new file mode 100644 index 0000000..7234cad --- /dev/null +++ b/tests/config/default/subdir/Makefile.omk @@ -0,0 +1 @@ +default_CONFIG = CONFIG_SUBDIR=y diff --git a/tests/functions.sh b/tests/functions.sh index 3d7da51..dc4b7a8 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -1,2 +1,11 @@ # -*-sh-*- +function error() { + echo $1 > _error + exit 1 +} + +function canttest() { + echo $1 > _error + exit 2 +} diff --git a/tests/headers/files/Makefile b/tests/headers/files/Makefile new file mode 100644 index 0000000..f595272 --- /dev/null +++ b/tests/headers/files/Makefile @@ -0,0 +1,14 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + diff --git a/tests/headers/files/Makefile.omk b/tests/headers/files/Makefile.omk new file mode 100644 index 0000000..91b2dc5 --- /dev/null +++ b/tests/headers/files/Makefile.omk @@ -0,0 +1,4 @@ +include_HEADERS = x.h periph/sci_regs.h +nobase_include_HEADERS = periph/sci_channels.h +renamed_include_HEADERS = x.h->y.h +renamed_include_HEADERS += orte/orte_config_omk_win32.h->orte/orte_config.h diff --git a/tests/headers/files/ls-include.txt b/tests/headers/files/ls-include.txt new file mode 100644 index 0000000..776116d --- /dev/null +++ b/tests/headers/files/ls-include.txt @@ -0,0 +1,12 @@ +.: +orte +periph +sci_regs.h +x.h +y.h + +./orte: +orte_config.h + +./periph: +sci_channels.h diff --git a/tests/headers/files/orte/orte_config_omk_win32.h b/tests/headers/files/orte/orte_config_omk_win32.h new file mode 100644 index 0000000..adb5b31 --- /dev/null +++ b/tests/headers/files/orte/orte_config_omk_win32.h @@ -0,0 +1,243 @@ +/* orte/include/orte/orte_config.h. Generated by configure. */ +/* orte/include/orte/orte_config.h.in. Generated from configure.in by autoheader. */ + +/* Define to enable JORTE's compilation */ +/* #undef CONFIG_JORTE */ + +/* Define if is target CYGWIN */ +/* #undef CONFIG_ORTE_CYGWIN */ + +/* Define if linux kernel is found */ +/* #undef CONFIG_ORTE_KERNEL */ + +/* Define if is target MINGW */ +#define CONFIG_ORTE_MINGW 1 + +/* Define to enable ORTE's RT support */ +/* #undef CONFIG_ORTE_RT */ + +/* Define if kernel is RTAI patched */ +/* #undef CONFIG_ORTE_RTAI */ + +/* Define if kernel is RTLinux patched */ +/* #undef CONFIG_ORTE_RTL */ + +/* Define if onetd stack is found */ +/* #undef CONFIG_ORTE_RTL_ONETD */ + +/* Define if wIP stack is found */ +/* #undef CONFIG_ORTE_RTL_WIP */ + +/* Define if is target a unix system */ +/* #undef CONFIG_ORTE_UNIX */ + +/* Define if is target windows */ +#define CONFIG_ORTE_WIN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_INET_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ASM_BYTEORDER_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BYTESWAP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +/* #undef HAVE_GETHOSTBYNAME */ + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the `getopt_long' function. */ +/* #undef HAVE_GETOPT_LONG */ + +/* Define for ORTE getopt_long self implemetation */ +#define HAVE_GETPOT_LONG_ORTE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `c_r' library (-lc_r). */ +/* #undef HAVE_LIBC_R */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `popt' library (-lpopt). */ +/* #undef HAVE_LIBPOPT */ + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +/* #undef HAVE_LIBPTHREAD */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ +#define HAVE_LIBWS2_32 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_CTYPE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_IF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_IN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_MODULE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_STRING_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_TIME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_TYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETDB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_IN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NET_IF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NICTAB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NIC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ONETD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PTHREAD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RTL_MALLOC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RTNET_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TIME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UDP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_W32API_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WS2TCPIP_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define ORTE_PACKAGE_BUGREPORT "petr.smolik@wo.cz" + +/* Define to the full name of this package. */ +#define ORTE_PACKAGE_NAME "orte" + +/* Define to the full name and version of this package. */ +#define ORTE_PACKAGE_STRING "orte 0.3.1" + +/* Define to the one symbol short name of this package. */ +#define ORTE_PACKAGE_TARNAME "orte" + +/* Define to the version of this package. */ +#define ORTE_PACKAGE_VERSION "0.3.1" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + + +#ifndef _GNU_SOURCE + #define _GNU_SOURCE +#endif + + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif diff --git a/tests/headers/files/periph/sci_channels.h b/tests/headers/files/periph/sci_channels.h new file mode 100644 index 0000000..5101480 --- /dev/null +++ b/tests/headers/files/periph/sci_channels.h @@ -0,0 +1,37 @@ +/******************************************************************* + Components for embedded applications builded for + laboratory and medical instruments firmware + + sci_channels.h - UART communication for H2638 microcontroller + + (C) 2005 by Michal Sojka + + The COLAMI components can be used and copied according to next + license alternatives + - MPL - Mozilla Public License + - GPL - GNU Public License + + *******************************************************************/ +#ifndef _SCI_PORTS_H +#define _SCI_PORTS_H + +#include +#include + +extern sci_info_t sci_rs232_chan0, sci_rs232_chan1, sci_rs232_chan2; + +extern sci_info_t *sci_rs232_chan_array[]; + +#ifndef SCI_RS232_CHAN_DEFAULT +#define SCI_RS232_CHAN_DEFAULT 0 +#endif + +/** + * This variable selects the default channel for use by IO functions + * (prtinf etc.). You can change the value of this variable in your + * application or by defining SCI_RS232_CHAN_DEFAULT symbol (probably + * in system_def.h). + */ +extern int sci_rs232_chan_default; + +#endif diff --git a/tests/headers/files/periph/sci_regs.h b/tests/headers/files/periph/sci_regs.h new file mode 100644 index 0000000..9b436b4 --- /dev/null +++ b/tests/headers/files/periph/sci_regs.h @@ -0,0 +1,33 @@ +/******************************************************************* + Components for embedded applications builded for + laboratory and medical instruments firmware + + sci_regs.h - UART communication for H2638 microcontroller + + (C) 2005 by Michal Sojka + (C) 2005 by Petr Kovacik + + The COLAMI components can be used and copied according to next + license alternatives + - MPL - Mozilla Public License + - GPL - GNU Public License + + *******************************************************************/ + +#ifndef _SCI_REGS_H +#define _SCI_REGS_H + +#include + +struct sci_regs { + volatile __u8 rs232_smr; + volatile __u8 rs232_brr; + volatile __u8 rs232_scr; + volatile __u8 rs232_tdr; + volatile __u8 rs232_ssr; + volatile __u8 rs232_rdr; + volatile __u8 rs232_scmr; +}; + + +#endif /* _SCI_REGS_H */ diff --git a/tests/headers/files/rules b/tests/headers/files/rules new file mode 100644 index 0000000..cfb1354 --- /dev/null +++ b/tests/headers/files/rules @@ -0,0 +1 @@ +snip:include diff --git a/tests/headers/files/runtest b/tests/headers/files/runtest new file mode 100755 index 0000000..13d64e2 --- /dev/null +++ b/tests/headers/files/runtest @@ -0,0 +1,10 @@ +#!/bin/sh + +. $OMK_TESTSROOT/functions.sh + +touch config.omk-default +make || exit 2 + +(cd _compiled/include || exit 2; ls -R -1) > ls-include.test || canttest "Can't find include directory" + +diff -u ls-include.txt ls-include.test || error "Include files are produced incorrectly" diff --git a/tests/headers/files/x.h b/tests/headers/files/x.h new file mode 100644 index 0000000..032ca32 --- /dev/null +++ b/tests/headers/files/x.h @@ -0,0 +1 @@ +// Hello \ No newline at end of file diff --git a/tests/headers/generated/Makefile b/tests/headers/generated/Makefile new file mode 100644 index 0000000..f595272 --- /dev/null +++ b/tests/headers/generated/Makefile @@ -0,0 +1,14 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + diff --git a/tests/headers/generated/Makefile.omk b/tests/headers/generated/Makefile.omk new file mode 100644 index 0000000..14ec3b1 --- /dev/null +++ b/tests/headers/generated/Makefile.omk @@ -0,0 +1,9 @@ +SUBDIRS=lincan + +default_CONFIG = CONFIG_TEST_NUM=123 CONFIG_TEST_STR="Hello" + + +config_include_HEADERS = global.h + +global_DEFINES = CONFIG_OC_LINCAN CONFIG_OC_LINCANRTL \ + CONFIG_TEST_NUM CONFIG_TEST_STR diff --git a/tests/headers/generated/config.omk-default b/tests/headers/generated/config.omk-default new file mode 100644 index 0000000..14a1f20 --- /dev/null +++ b/tests/headers/generated/config.omk-default @@ -0,0 +1,43 @@ +# Start of OMK config file +# This file should not be altered manually +# Overrides should be stored in file config.omk + +# Config for lincan +CONFIG_OC_LINCAN=y +CONFIG_OC_LINCANRTL=n +CONFIG_OC_LINCANVME=n +CONFIG_OC_LINCAN_PORTIO_ONLY=n +CONFIG_OC_LINCAN_MEMIO_ONLY=n +CONFIG_OC_LINCAN_DETAILED_ERRORS=y +CONFIG_OC_LINCAN_CARD_pip=y +CONFIG_OC_LINCAN_CARD_pccan=y +CONFIG_OC_LINCAN_CARD_smartcan=y +CONFIG_OC_LINCAN_CARD_nsi=y +CONFIG_OC_LINCAN_CARD_cc_can104=y +CONFIG_OC_LINCAN_CARD_ems_cpcpci=y +CONFIG_OC_LINCAN_CARD_pc_i03=y +CONFIG_OC_LINCAN_CARD_pcm3680=y +CONFIG_OC_LINCAN_CARD_aim104=y +CONFIG_OC_LINCAN_CARD_m437=y +CONFIG_OC_LINCAN_CARD_pcccan=y +CONFIG_OC_LINCAN_CARD_ssv=y +CONFIG_OC_LINCAN_CARD_bfadcan=y +CONFIG_OC_LINCAN_CARD_gensja1000io=y +CONFIG_OC_LINCAN_CARD_pikronisa=y +CONFIG_OC_LINCAN_CARD_eb8245=y +CONFIG_OC_LINCAN_CARD_kv_pcican=y +CONFIG_OC_LINCAN_CARD_msmcan=y +CONFIG_OC_LINCAN_CARD_oscar=y +CONFIG_OC_LINCAN_CARD_adlink7841=y +CONFIG_OC_LINCAN_CARD_unican=y +CONFIG_OC_LINCAN_CARD_virtual=y +CONFIG_OC_LINCAN_CARD_template=y +CONFIG_OC_LINCAN_CARD_hms30c7202_can=n +CONFIG_OC_LINCAN_CARD_ns_dev_can=n +CONFIG_OC_LINCAN_CARD_ipci165=n +CONFIG_OC_LINCAN_CARD_pimx1=n +CONFIG_OC_LINCAN_CARD_tscan1=n +CONFIG_OC_LINCAN_CARD_nsi_canpci=n +# Config for +CONFIG_TEST_NUM=123 +CONFIG_TEST_STR=Hello diff --git a/tests/headers/generated/correct/global.h b/tests/headers/generated/correct/global.h new file mode 100644 index 0000000..bc98500 --- /dev/null +++ b/tests/headers/generated/correct/global.h @@ -0,0 +1,7 @@ +/* Automatically generated from */ +#ifndef _global_H +#define _global_H +#define CONFIG_OC_LINCAN 1 +#define CONFIG_TEST_NUM 123 +#define CONFIG_TEST_STR Hello +#endif /* _global_H */ diff --git a/tests/headers/generated/correct/lincan_config.h b/tests/headers/generated/correct/lincan_config.h new file mode 100644 index 0000000..2ca8eac --- /dev/null +++ b/tests/headers/generated/correct/lincan_config.h @@ -0,0 +1,29 @@ +/* Automatically generated from */ +#ifndef _LOCAL_CONFIG_H +#define _LOCAL_CONFIG_H +#define CONFIG_OC_LINCAN 1 +#define CONFIG_OC_LINCAN_DETAILED_ERRORS 1 +#define CONFIG_OC_LINCAN_CARD_pip 1 +#define CONFIG_OC_LINCAN_CARD_pccan 1 +#define CONFIG_OC_LINCAN_CARD_smartcan 1 +#define CONFIG_OC_LINCAN_CARD_nsi 1 +#define CONFIG_OC_LINCAN_CARD_cc_can104 1 +#define CONFIG_OC_LINCAN_CARD_ems_cpcpci 1 +#define CONFIG_OC_LINCAN_CARD_pc_i03 1 +#define CONFIG_OC_LINCAN_CARD_pcm3680 1 +#define CONFIG_OC_LINCAN_CARD_aim104 1 +#define CONFIG_OC_LINCAN_CARD_m437 1 +#define CONFIG_OC_LINCAN_CARD_pcccan 1 +#define CONFIG_OC_LINCAN_CARD_ssv 1 +#define CONFIG_OC_LINCAN_CARD_bfadcan 1 +#define CONFIG_OC_LINCAN_CARD_gensja1000io 1 +#define CONFIG_OC_LINCAN_CARD_pikronisa 1 +#define CONFIG_OC_LINCAN_CARD_eb8245 1 +#define CONFIG_OC_LINCAN_CARD_kv_pcican 1 +#define CONFIG_OC_LINCAN_CARD_msmcan 1 +#define CONFIG_OC_LINCAN_CARD_oscar 1 +#define CONFIG_OC_LINCAN_CARD_adlink7841 1 +#define CONFIG_OC_LINCAN_CARD_unican 1 +#define CONFIG_OC_LINCAN_CARD_virtual 1 +#define CONFIG_OC_LINCAN_CARD_template 1 +#endif /*_LOCAL_CONFIG_H*/ diff --git a/tests/headers/generated/lincan/Makefile b/tests/headers/generated/lincan/Makefile new file mode 100644 index 0000000..f595272 --- /dev/null +++ b/tests/headers/generated/lincan/Makefile @@ -0,0 +1,14 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + diff --git a/tests/headers/generated/lincan/Makefile.omk b/tests/headers/generated/lincan/Makefile.omk new file mode 100644 index 0000000..2affd3b --- /dev/null +++ b/tests/headers/generated/lincan/Makefile.omk @@ -0,0 +1,18 @@ +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 + +lincan_morecards_NAMES = hms30c7202_can ns_dev_can ipci165 pimx1 tscan1 nsi_canpci + +default_CONFIG = CONFIG_OC_LINCAN=y CONFIG_OC_LINCANRTL=n CONFIG_OC_LINCANVME=n +default_CONFIG += CONFIG_OC_LINCAN_PORTIO_ONLY=n CONFIG_OC_LINCAN_MEMIO_ONLY=n +default_CONFIG += CONFIG_OC_LINCAN_DETAILED_ERRORS=y +default_CONFIG += $(foreach n, $(lincan_cards_NAMES), CONFIG_OC_LINCAN_CARD_$(n)=y) +default_CONFIG += $(foreach n, $(lincan_morecards_NAMES), CONFIG_OC_LINCAN_CARD_$(n)=n) + + +LOCAL_CONFIG_H = lincan_config.h + +# Local config is not generated if nothing is compiled +bin_PROGRAMS = configtest +configtest_SOURCES = configtest.c diff --git a/tests/headers/generated/lincan/configtest.c b/tests/headers/generated/lincan/configtest.c new file mode 100644 index 0000000..5c5d3b9 --- /dev/null +++ b/tests/headers/generated/lincan/configtest.c @@ -0,0 +1,2 @@ +#include "lincan_config.h" +void main(void) {} diff --git a/tests/headers/generated/runtest b/tests/headers/generated/runtest new file mode 100755 index 0000000..037e3e1 --- /dev/null +++ b/tests/headers/generated/runtest @@ -0,0 +1,17 @@ +#!/bin/sh + +. $OMK_TESTSROOT/functions.sh + +make default-config || canttest +make include-pass || error "Can't run make include-pass" + +GC=./_compiled/include/global.h +test -f "$GC" || canttest "Can't find the produced global config" + +grep -Fv "/* config file:" $GC | diff -u correct/global.h - || error "Global config differs" + +make CC=true || cannot "Can't run make to produce local config" +LC=$(find _build -wholename '*/lincan/lincan_config.h') +test -f "$LC" || canttest "Can't find the produced local config" +grep -Fv "/* config file:" $LC | diff -u correct/lincan_config.h - || error "Local config differs" + diff --git a/tests/runtests.py b/tests/runtests.py index 4228ad2..276114e 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -7,6 +7,7 @@ import re import shutil import subprocess import time +from xml.sax.saxutils import escape sys.path.append("..") import rulesdef @@ -30,7 +31,7 @@ class Results(dict):

Summary

TODO - """ + """ % self.__dict__ s+="""

Chart

@@ -90,7 +91,7 @@ class ResultEntry: else: if self.exitcode == 1: color=' bgcolor="red"' elif self.exitcode == 2: color=' bgcolor="yellow"' - else: color=' bgcolor="silver"' + else: color=' bgcolor="gray"' if self.stdout: stdoutlink="stdout" % self.__dict__ else: stdoutlink='' if self.stderr: stderrlink="stderr" % self.__dict__ @@ -109,7 +110,7 @@ class ResultEntry: 'tcname' : self.rules, 'rules' : self.rules, 'exitcode' : self.exitcode, - 'message' : self.message, + 'message' : escape(self.message), 'time' : self.time, 'stdoutlink' : stdoutlink, 'stderrlink' : stderrlink, @@ -119,8 +120,8 @@ class ResultEntry: vals = { 'tcname':self.tcname, 'rules':self.rules, - 'stdout':self.stdout, - 'stderr':self.stderr + 'stdout':escape(self.stdout), + 'stderr':escape(self.stderr) } s="" if self.stdout: s+=""" @@ -194,9 +195,11 @@ class TestCase: os.environ['OMK_RULES'] = rules filesBefore = self._getFileSet() self._copyRules(rules) - self._doRun(resultEntry) - filesAfter = self._getFileSet() - self._clean(filesBefore, filesAfter) + try: + self._doRun(resultEntry) + finally: + filesAfter = self._getFileSet() + self._clean(filesBefore, filesAfter) print def _getFileSet(self): @@ -242,6 +245,7 @@ class TestCase: testsRoot = os.path.dirname(os.path.abspath(__file__)) if not os.path.exists(os.path.join(testsRoot, "runtests.py")): raise "Can't find tests root directory!" +os.environ['OMK_TESTSROOT'] = testsRoot results = Results() diff --git a/tests/vxworks/Makefile b/tests/vxworks/Makefile new file mode 100644 index 0000000..f595272 --- /dev/null +++ b/tests/vxworks/Makefile @@ -0,0 +1,14 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + diff --git a/tests/vxworks/Makefile.omk b/tests/vxworks/Makefile.omk new file mode 100644 index 0000000..fd1cf10 --- /dev/null +++ b/tests/vxworks/Makefile.omk @@ -0,0 +1 @@ +SUBDIRS = fibo-rtp fibo-rtplib #orte diff --git a/tests/vxworks/rules b/tests/vxworks/rules new file mode 100644 index 0000000..afbf2b5 --- /dev/null +++ b/tests/vxworks/rules @@ -0,0 +1 @@ +vxworks \ No newline at end of file -- 2.39.2