From 12f1a0c2e46f8578e4093fa86013c22202d19b8d Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Wed, 6 Feb 2013 20:28:20 +0100 Subject: Added initial README. --- cmake/README.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 cmake/README.txt (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt new file mode 100644 index 00000000..836a4be4 --- /dev/null +++ b/cmake/README.txt @@ -0,0 +1,10 @@ +CMake is a build automation system + http://en.wikipedia.org/wiki/Cmake + +We try to use it as a replacement for the established GNU build system. +This attempt is currently only experimental. If you wonder why anyone +should do this, read + + Why the KDE project switched to CMake -- and how + http://lwn.net/Articles/188693/ + -- cgit v1.2.3 From 35653e6bd56e589a0525c3012a16353420375a6f Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Fri, 8 Feb 2013 09:40:01 +0100 Subject: Added Toolchain files as examples for cross-compilation. --- cmake/Toolchain_generic.cmake | 21 +++++++++++++++++++++ cmake/Toolchain_mingw32.cmake | 23 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 cmake/Toolchain_generic.cmake create mode 100644 cmake/Toolchain_mingw32.cmake (limited to 'cmake') diff --git a/cmake/Toolchain_generic.cmake b/cmake/Toolchain_generic.cmake new file mode 100644 index 00000000..bbd25593 --- /dev/null +++ b/cmake/Toolchain_generic.cmake @@ -0,0 +1,21 @@ +# http://www.cmake.org/Wiki/CmakeMingw +# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Generic) + +# which compilers to use for C and C++ +# Settings for Ubuntu 12.04.1 LTS +SET(CMAKE_C_COMPILER /usr/bin/gcc) + +# here is the target environment located +# Settings for Ubuntu 12.04.1 LTS +SET(CMAKE_FIND_ROOT_PATH /usr/include) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + diff --git a/cmake/Toolchain_mingw32.cmake b/cmake/Toolchain_mingw32.cmake new file mode 100644 index 00000000..8f1d2fbd --- /dev/null +++ b/cmake/Toolchain_mingw32.cmake @@ -0,0 +1,23 @@ +# http://www.cmake.org/Wiki/CmakeMingw +# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Windows) + +# which compilers to use for C and C++ +# Settings for Ubuntu 12.04.1 LTS +SET(CMAKE_C_COMPILER /usr/bin/i686-w64-mingw32-gcc) +SET(CMAKE_CXX_COMPILER /usr/bin/i686-w64-mingw32-g++) +SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres) + +# here is the target environment located +# Settings for Ubuntu 12.04.1 LTS +SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/i686-w64-mingw32/include) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + -- cgit v1.2.3 From ac9bad12d159288eeaf704da3aeed63a859339cf Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Fri, 8 Feb 2013 11:05:21 +0100 Subject: Explained how to get gawk built with CMake. --- cmake/README.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt index 836a4be4..aae024c6 100644 --- a/cmake/README.txt +++ b/cmake/README.txt @@ -8,3 +8,36 @@ should do this, read Why the KDE project switched to CMake -- and how http://lwn.net/Articles/188693/ +- How can I get gawk compiled with CMake as fast as possible ? + git clone git://git.savannah.gnu.org/gawk.git + cd gawk + git checkout cmake + mkdir build + cd build + cmake .. + make + ./gawk --version +Notice that this git-checkout allows you to read the source code, +track the cmake branch and get updates. You will not be able to +commit anything. http://savannah.gnu.org/maintenance/UsingGit + +- What is the current status of the cmake branch ? +It has just begun, pre-alpha, unclear if it will ever be taken up +by the maintainer. We want to study if using CMake with such a +basic tool like gawk is feasible and if it easier to use than +the GNU build system. + +- Where can I find a tutorial on CMake basics ? +Use the "official tutorial": + http://www.cmake.org/cmake/help/cmake_tutorial.html + +- Where is the reference of all commands and variables ? +Depending on the CMake version you use, select one of these: + http://www.cmake.org/cmake/help/v2.8.10/cmake.html + +- How can I cross-compile ? +Proceed in the same way as explained above for native compilation, +but use a different build directory. When using CMake, do this: + cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain_mingw32.cmake .. +Write a new Toolchain file for your cross-compiler and use it. + -- cgit v1.2.3 From fa30c4248c55cbce828bd9f31f5d45ca842464b3 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Fri, 8 Feb 2013 13:50:41 +0100 Subject: Added some more hints about what to do. --- cmake/README.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt index aae024c6..d6e693b8 100644 --- a/cmake/README.txt +++ b/cmake/README.txt @@ -19,7 +19,20 @@ should do this, read ./gawk --version Notice that this git-checkout allows you to read the source code, track the cmake branch and get updates. You will not be able to -commit anything. http://savannah.gnu.org/maintenance/UsingGit +commit anything. + +- How can I use git to contribute source code ? +You need an account at Savannah. Read this to understand the first steps: + http://savannah.gnu.org/maintenance/UsingGit + README.git +Use your account there to register your public ssh key at Savannah. +Then you are ready to checkout. Remember that (when cloning) you are +setting up your own local repository and make sure you configure it +properly. + git clone ssh://my_account_name@git.sv.gnu.org/srv/git/gawk.git + git config --global user.name "first-name last-name" + git config --global user.email First.Last@email.com + git config --global color.ui auto - What is the current status of the cmake branch ? It has just begun, pre-alpha, unclear if it will ever be taken up -- cgit v1.2.3 From dac059baf5518edf195c873db91eb42af6551586 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 9 Feb 2013 00:31:23 +0100 Subject: New script helps in test-automation. --- cmake/basictest | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 cmake/basictest (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest new file mode 100755 index 00000000..5a874f8c --- /dev/null +++ b/cmake/basictest @@ -0,0 +1,11 @@ +#!/bin/sh + +TESTHOME=$(dirname ${0})/../test +if test -r ${TESTHOME}/${2}.in +then + $1 -f ${TESTHOME}/${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} +else + $1 -f ${TESTHOME}/${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} +fi +cmp ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} + -- cgit v1.2.3 From 251fa761931520336e19fb09af583954a6f481ce Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 9 Feb 2013 19:55:07 +0100 Subject: A slightly better but still crude approach at getting many tests to run. More than 90% of the basic tests pass now. --- cmake/basictest | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 5a874f8c..958c778b 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -1,11 +1,12 @@ #!/bin/sh TESTHOME=$(dirname ${0})/../test +export AWKPATH=${TESTHOME} if test -r ${TESTHOME}/${2}.in then - $1 -f ${TESTHOME}/${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $1 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} else - $1 -f ${TESTHOME}/${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $1 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} fi cmp ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} -- cgit v1.2.3 From 478c3f9f2f8f0d3a3e3e8ac4ea412a6ee7e54b86 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 9 Feb 2013 23:23:41 +0100 Subject: All extensions can be built as shared libraries now. It was necessary to remove -DGAWK when building the extensions. The test cases involving extensions still fail. --- cmake/basictest | 1 + 1 file changed, 1 insertion(+) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 958c778b..6fe5db5a 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -2,6 +2,7 @@ TESTHOME=$(dirname ${0})/../test export AWKPATH=${TESTHOME} +export LANG=C if test -r ${TESTHOME}/${2}.in then $1 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} -- cgit v1.2.3 From fb189c40596609a4026bedaaca2a344b177d905a Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 10 Feb 2013 16:09:40 +0100 Subject: Made building of extensions a bit more robust. --- cmake/README.txt | 1 + cmake/basictest | 1 + 2 files changed, 2 insertions(+) (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt index d6e693b8..4e24cc1f 100644 --- a/cmake/README.txt +++ b/cmake/README.txt @@ -17,6 +17,7 @@ should do this, read cmake .. make ./gawk --version + make test Notice that this git-checkout allows you to read the source code, track the cmake branch and get updates. You will not be able to commit anything. diff --git a/cmake/basictest b/cmake/basictest index 6fe5db5a..86f6ff66 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -2,6 +2,7 @@ TESTHOME=$(dirname ${0})/../test export AWKPATH=${TESTHOME} +export AWKLIBPATH=${TESTHOME}/../build/extension/ export LANG=C if test -r ${TESTHOME}/${2}.in then -- cgit v1.2.3 From 1fa5be5e29fb1a7096173be2b76c4b83d8e41b28 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 10 Feb 2013 17:16:25 +0100 Subject: All 265 basic test cases pass now. --- cmake/basictest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 86f6ff66..42cb2864 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -6,9 +6,9 @@ export AWKLIBPATH=${TESTHOME}/../build/extension/ export LANG=C if test -r ${TESTHOME}/${2}.in then - $1 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $1 $3 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} else - $1 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $1 $3 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} fi cmp ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} -- cgit v1.2.3 From 9d0462137c48a149b41ffc8cce183999374c8683 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Wed, 13 Feb 2013 08:58:16 +0100 Subject: Moved much code into new files for configuring and packaging. --- cmake/configure.cmake | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++ cmake/package.cmake | 38 +++++++++ 2 files changed, 264 insertions(+) create mode 100644 cmake/configure.cmake create mode 100644 cmake/package.cmake (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake new file mode 100644 index 00000000..8b285e51 --- /dev/null +++ b/cmake/configure.cmake @@ -0,0 +1,226 @@ +# +# cmake/configure --- CMake input file for gawk +# +# Copyright (C) 2013 +# the Free Software Foundation, Inc. +# +# This file is part of GAWK, the GNU implementation of the +# AWK Programming Language. +# +# GAWK is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# GAWK is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + +## process this file with CMake to produce Makefile + +include(CheckIncludeFiles) +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CheckFunctionExists) +include(CheckLibraryExists) +include(CheckTypeSize) +include(CheckStructHasMember) + +MACRO(DefineFunctionIfAvailable func feature) + check_function_exists("${func}" "${feature}") + IF (${feature}) + ADD_DEFINITIONS (-D ${feature}) + ENDIF () +ENDMACRO(DefineFunctionIfAvailable) + +MACRO(DefineHFileIfAvailable hfile feature) + check_include_file("${hfile}" "${feature}") + IF (${feature}) + ADD_DEFINITIONS (-D ${feature}) + ENDIF () +ENDMACRO(DefineHFileIfAvailable) + +MACRO(DefineTypeIfAvailable type feature) + check_type_size("${type}" "${feature}") + IF (${feature}) + ADD_DEFINITIONS (-D ${feature}=${${feature}}) + ENDIF () +ENDMACRO(DefineTypeIfAvailable) + +MACRO(DefineSymbolIfAvailable symbol hfile feature) + check_symbol_exists("${symbol}" "${hfile}" "${feature}") + IF (${feature}) + ADD_DEFINITIONS (-D ${feature}) + ENDIF () +ENDMACRO(DefineSymbolIfAvailable) + +MACRO(DefineStructHasMemberIfAvailable struct member hfile feature) + check_struct_has_member("${struct}" "${member}" "${hfile}" "${feature}") + IF (${feature}) + ADD_DEFINITIONS (-D ${feature}) + ENDIF () +ENDMACRO(DefineStructHasMemberIfAvailable) + +MACRO(DefineLibraryIfAvailable lib func location feature) + check_library_exists("${lib}" "${func}" "${location}" "${feature}") + IF (${feature}) + ADD_DEFINITIONS (-D ${feature}) + ENDIF () +ENDMACRO(DefineLibraryIfAvailable) + +file( WRITE config.h "/* empty file, all settings defined by CMake. */" ) +# Configure a header file to pass some of the CMake settings +# to the source code +# http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:configure_file +# CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h IMMEDIATE ) + +FILE( READ configure.ac CONFIG_AUTOMAKE ) +STRING( REGEX MATCH "AC_INIT\\(\\[GNU Awk\\], ([0-9]+\\.[0-9]+\\.[0-9]+)" GAWK_AUTOMAKE_LINE_VERSION "${CONFIG_AUTOMAKE}") +STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GAWK_MAJOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") +STRING( REGEX REPLACE ".*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" GAWK_MINOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") +STRING( REGEX REPLACE ".*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" GAWK_BUGFIX_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") + +add_definitions(-DGAWK) +set(GAWK_VERSION "${GAWK_MAJOR_VERSION}.${GAWK_MINOR_VERSION}.${GAWK_BUGFIX_VERSION}") +add_definitions(-D VERSION=\\"${GAWK_VERSION}\\") +add_definitions(-D PACKAGE=\\"gawk\\") +add_definitions(-D PACKAGE_STRING="GNU Awk ${GAWK_VERSION}") +add_definitions(-D PACKAGE_TARNAME=\\"gawk\\") +add_definitions(-D PACKAGE_URL=\\"http://www.gnu.org/software/gawk/\\") +add_definitions(-D PACKAGE_VERSION=\\"${GAWK_VERSION}\\") +add_definitions(-D DEFPATH=\\"${CMAKE_BINARY_DIR}/awk\\") +add_definitions(-D DEFLIBPATH=\\"${CMAKE_BINARY_DIR}/lib\\") +#DefineFunctionIfAvailable(dlopen DYNAMIC) +DefineHFileIfAvailable(dlfcn.h DYNAMIC) +#add_definitions(-D SHLIBEXT=\\"${CMAKE_SHARED_LIBRARY_SUFFIX}\\") +add_definitions(-D SHLIBEXT=\\"so\\") +DefineTypeIfAvailable("unsigned int" SIZEOF_UNSIGNED_INT) +DefineTypeIfAvailable("unsigned long" SIZEOF_UNSIGNED_LONG) +#/* Define to 1 if *printf supports %F format */ +add_definitions(-D PRINTF_HAS_F_FORMAT) +#/* Define as the return type of signal handlers (`int' or `void'). */ +add_definitions(-D RETSIGTYPE=void) +#add_definitions(-D PIPES_SIMULATED) +add_definitions(-D GETPGRP_VOID) +#add_definitions(-D YYPARSE_PARAM) + +DefineFunctionIfAvailable(snprintf HAVE_SNPRINTF) +DefineFunctionIfAvailable(vprintf HAVE_VPRINTF) +DefineHFileIfAvailable(sys/types.h HAVE_SYS_TYPES_H) +DefineHFileIfAvailable(sys/stat.h HAVE_SYS_STAT_H) +DefineHFileIfAvailable(string.h HAVE_STRING_H) +DefineHFileIfAvailable(memory.h HAVE_MEMORY_H) +DefineHFileIfAvailable(strings.h HAVE_STRINGS_H) +DefineHFileIfAvailable(stdint.h HAVE_STDINT_H) +DefineHFileIfAvailable(inttypes.h HAVE_INTTYPES_H) +DefineHFileIfAvailable(stdlib.h HAVE_STDLIB_H) +DefineHFileIfAvailable(unistd.h HAVE_UNISTD_H) +DefineFunctionIfAvailable(gettext HAVE_GETTEXT) +DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT) + FIND_PACKAGE(Gettext REQUIRED) +# FIND_PACKAGE(XGettext REQUIRED) +# FIND_PACKAGE(Iconv REQUIRED) + FIND_PATH(INTL_INCLUDE_DIR libintl.h PATHS /usr/include /usr/local/include) + FIND_LIBRARY(INTL_LIBRARIES intl c PATHS /usr/lib/ /usr/local/lib) +DefineSymbolIfAvailable("CODESET" "langinfo.h" HAVE_LANGINFO_CODESET) +DefineSymbolIfAvailable("LC_MESSAGES" "locale.h" HAVE_LC_MESSAGES) +DefineTypeIfAvailable("_Bool" HAVE__BOOL) +if (${HAVE_GETTEXT} AND ${HAVE_DCGETTEXT} AND ${HAVE_LANGINFO_CODESET} AND ${HAVE_LC_MESSAGES}) + add_definitions(-D LOCALEDIR=\\"/usr/share/locale\\") + add_definitions(-D ENABLE_NLS) + ADD_SUBDIRECTORY( po ) +endif() +DefineHFileIfAvailable(stdbool.h HAVE_STDBOOL_H) +DefineHFileIfAvailable(sys/wait.h HAVE_SYS_WAIT_H) +DefineHFileIfAvailable(arpa/inet.h HAVE_ARPA_INET_H) +DefineHFileIfAvailable(fcntl.h HAVE_FCNTL_H) +DefineHFileIfAvailable(limits.h HAVE_LIMITS_H) +DefineHFileIfAvailable(locale.h HAVE_LOCALE_H) +DefineHFileIfAvailable(libintl.h HAVE_LIBINTL_H) +DefineHFileIfAvailable(mcheck.h HAVE_MCHECK_H) +DefineHFileIfAvailable(netdb.h HAVE_NETDB_H) +DefineHFileIfAvailable(netinet/in.h HAVE_NETINET_IN_H) +DefineHFileIfAvailable(stdarg.h HAVE_STDARG_H) +DefineHFileIfAvailable(stddef.h HAVE_STDDEF_H) +DefineHFileIfAvailable(sys/ioctl.h HAVE_SYS_IOCTL_H) +DefineHFileIfAvailable(sys/param.h HAVE_SYS_PARAM_H) +DefineHFileIfAvailable(sys/socket.h HAVE_SYS_SOCKET_H) +DefineHFileIfAvailable(sys/termios.h HAVE_TERMIOS_H) +DefineHFileIfAvailable(stropts.h HAVE_STROPTS_H) +DefineHFileIfAvailable(wchar.h HAVE_WCHAR_H) +DefineHFileIfAvailable(wctype.h HAVE_WCTYPE_H) +#DefineTypeIfAvailable("long long int" HAVE_LONG_LONG_INT) +#add_definitions(-D HAVE_UNSIGNED_LONG_LONG_INT) +DefineTypeIfAvailable(intmax_t INTMAX_T) +DefineTypeIfAvailable(uintmax_t UINTMAX_T) + +# Some of these dont work, maybe CheckCSourceCompiles would be better. +DefineTypeIfAvailable("time_t" TIME_T_IN_SYS_TYPES_H) +DefineTypeIfAvailable("wctype_t" WCTYPE_T) +add_definitions(-D WINT_T) +#DefineTypeIfAvailable("wint_t" WINT_T) +add_definitions(-D HAVE_SOCKADDR_STORAGE) +#DefineTypeIfAvailable("struct sockaddr_storage" SOCKADDR_STORAGE) +add_definitions(-D HAVE_STRUCT_STAT_ST_BLKSIZE) +#DefineStructHasMemberIfAvailable("struct stat" st_blksize bits/stat.h HAVE_STRUCT_STAT_ST_BLKSIZE) +add_definitions(-D HAVE_ST_BLKSIZE) +#DefineStructHasMemberIfAvailable("struct stat" st_blksize bits/stat.h HAVE_ST_BLKSIZE) +DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_TM_ZONE) +DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZONE) + +DefineHFileIfAvailable(sys/time.h HAVE_SYS_TIME_H) +DefineFunctionIfAvailable(alarm HAVE_ALARM) +DefineFunctionIfAvailable(mktime HAVE_MKTIME) +DefineFunctionIfAvailable(getaddrinfo HAVE_GETADDRINFO) +DefineFunctionIfAvailable(atexit HAVE_ATEXIT) +DefineFunctionIfAvailable(btowc HAVE_BTOWC) +add_definitions(-D HAVE_FMOD) +#DefineFunctionIfAvailable(fmod HAVE_FMOD) +DefineFunctionIfAvailable(isinf HAVE_ISINF) +DefineFunctionIfAvailable(ismod HAVE_ISMOD) +DefineFunctionIfAvailable(getgrent HAVE_GETGRENT) +DefineFunctionIfAvailable(getgroups HAVE_GETGROUPS) +add_definitions(-D GETGROUPS_T=gid_t) +DefineTypeIfAvailable("pid_t" PID_T) +DefineFunctionIfAvailable(grantpt HAVE_GRANTPT) +DefineFunctionIfAvailable(isascii HAVE_ISASCII) +DefineFunctionIfAvailable(iswctype HAVE_ISWCTYPE) +DefineFunctionIfAvailable(iswlower HAVE_ISWLOWER) +DefineFunctionIfAvailable(iswupper HAVE_ISUPPER) +DefineFunctionIfAvailable(mbrlen HAVE_MBRLEN) +DefineFunctionIfAvailable(memcmp HAVE_MEMCMP) +DefineFunctionIfAvailable(memcpy HAVE_MEMCPY) +DefineFunctionIfAvailable(memmove HAVE_MEMMOVE) +DefineFunctionIfAvailable(memset HAVE_MEMSET) +DefineFunctionIfAvailable(mkstemp HAVE_MKSTEMP) +DefineFunctionIfAvailable(posix_openpt HAVE_POSIX_OPENPT) +DefineFunctionIfAvailable(setenv HAVE_SETENV) +DefineFunctionIfAvailable(setlocale HAVE_SETLOCALE) +DefineFunctionIfAvailable(setsid HAVE_SETSID) +DefineFunctionIfAvailable(strchr HAVE_STRCHR) +DefineFunctionIfAvailable(strerror HAVE_STRERROR) +DefineFunctionIfAvailable(strftime HAVE_STRFTIME) +DefineFunctionIfAvailable(strncasecmp HAVE_STRNCASECMP) +DefineFunctionIfAvailable(strcoll HAVE_STRCOLL) +DefineFunctionIfAvailable(strtod HAVE_STRTOD) +DefineFunctionIfAvailable(strtoul HAVE_STRTOUL) +DefineFunctionIfAvailable(system HAVE_SYSTEM) +DefineFunctionIfAvailable(tmpfile HAVE_TMPFILE) +DefineFunctionIfAvailable(towlower HAVE_TOWLOWER) +DefineFunctionIfAvailable(towupper HAVE_TOWUPPER) +DefineFunctionIfAvailable(tzset HAVE_TZSET) +DefineFunctionIfAvailable(usleep HAVE_USLEEP) +DefineFunctionIfAvailable(wcrtomb HAVE_WCRTOMB) +DefineFunctionIfAvailable(wcscoll HAVE_WCSCOLL) +DefineFunctionIfAvailable(wctype HAVE_WCTYPE) +DefineFunctionIfAvailable(mbrtowc HAVE_MBRTOWC) + +add_definitions(-D HAVE_STRINGIZE) +add_definitions(-D _Noreturn=) + diff --git a/cmake/package.cmake b/cmake/package.cmake new file mode 100644 index 00000000..27fe285d --- /dev/null +++ b/cmake/package.cmake @@ -0,0 +1,38 @@ +# +# cmake/package --- CMake input file for gawk +# +# Copyright (C) 2013 +# the Free Software Foundation, Inc. +# +# This file is part of GAWK, the GNU implementation of the +# AWK Programming Language. +# +# GAWK is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# GAWK is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + +## process this file with CMake to produce Makefile + +SET(CPACK_GENERATOR "TGZ") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is GNU Awk ${GAWK_VERSION}") +SET(CPACK_PACKAGE_NAME "gawk") +SET(CPACK_PACKAGE_VERSION "${GAWK_VERSION}") +SET(CPACK_PACKAGE_VERSION_MAJOR "${GAWK_MAJOR_VERSION}") +SET(CPACK_PACKAGE_VERSION_MINOR "${GAWK_MINOR_VERSION}") +SET(CPACK_PACKAGE_VERSION_PATCH "${GAWK_BUGFIX_VERSION}") +SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") +SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README") +SET(CPACK_PACKAGING_INSTALL_PREFIX /usr) + +INCLUDE(CPack) -- cgit v1.2.3 From 8401ded64836e829620dfbbc2b6edf731edfb337 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 17 Feb 2013 14:44:47 +0100 Subject: CMake option USE_CONFIG_H allows to generate config.h. Some test cases with extensions still fail with this option switched ON. --- cmake/configure.cmake | 54 ++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 8b285e51..a4f3161f 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -24,6 +24,18 @@ ## process this file with CMake to produce Makefile +option (USE_CONFIG_H "Generate a file config.h for inclusion into C source code" OFF) +if (USE_CONFIG_H) + file( WRITE config.h "/* all settings defined by CMake. */\n\n" ) + ADD_DEFINITIONS (-D HAVE_CONFIG_H) + # Configure a header file to pass some of the CMake settings + # to the source code + # http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:configure_file + # CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h IMMEDIATE ) +else() + file( WRITE config.h "/* empty file, all settings defined by CMake. */" ) +endif() + include(CheckIncludeFiles) include(CheckIncludeFile) include(CheckSymbolExists) @@ -32,54 +44,48 @@ include(CheckLibraryExists) include(CheckTypeSize) include(CheckStructHasMember) +MACRO(DefineConfigH feature) +# message(STATUS feature=${feature}=${${feature}}) + if (${feature}) + if (${USE_CONFIG_H} STREQUAL ON) + FILE( APPEND config.h "#define ${feature} ${${feature}}\n") + else() + #ADD_DEFINITIONS (-D ${feature}) + ADD_DEFINITIONS (-D${feature}=${${feature}}) + endif () + endif () +ENDMACRO(DefineConfigH) + MACRO(DefineFunctionIfAvailable func feature) check_function_exists("${func}" "${feature}") - IF (${feature}) - ADD_DEFINITIONS (-D ${feature}) - ENDIF () + DefineConfigH(${feature}) ENDMACRO(DefineFunctionIfAvailable) MACRO(DefineHFileIfAvailable hfile feature) check_include_file("${hfile}" "${feature}") - IF (${feature}) - ADD_DEFINITIONS (-D ${feature}) - ENDIF () + DefineConfigH(${feature}) ENDMACRO(DefineHFileIfAvailable) MACRO(DefineTypeIfAvailable type feature) check_type_size("${type}" "${feature}") - IF (${feature}) - ADD_DEFINITIONS (-D ${feature}=${${feature}}) - ENDIF () + DefineConfigH(${feature}) ENDMACRO(DefineTypeIfAvailable) MACRO(DefineSymbolIfAvailable symbol hfile feature) check_symbol_exists("${symbol}" "${hfile}" "${feature}") - IF (${feature}) - ADD_DEFINITIONS (-D ${feature}) - ENDIF () + DefineConfigH(${feature}) ENDMACRO(DefineSymbolIfAvailable) MACRO(DefineStructHasMemberIfAvailable struct member hfile feature) check_struct_has_member("${struct}" "${member}" "${hfile}" "${feature}") - IF (${feature}) - ADD_DEFINITIONS (-D ${feature}) - ENDIF () + DefineConfigH(${feature}) ENDMACRO(DefineStructHasMemberIfAvailable) MACRO(DefineLibraryIfAvailable lib func location feature) check_library_exists("${lib}" "${func}" "${location}" "${feature}") - IF (${feature}) - ADD_DEFINITIONS (-D ${feature}) - ENDIF () + DefineConfigH(${feature}) ENDMACRO(DefineLibraryIfAvailable) -file( WRITE config.h "/* empty file, all settings defined by CMake. */" ) -# Configure a header file to pass some of the CMake settings -# to the source code -# http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:configure_file -# CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h IMMEDIATE ) - FILE( READ configure.ac CONFIG_AUTOMAKE ) STRING( REGEX MATCH "AC_INIT\\(\\[GNU Awk\\], ([0-9]+\\.[0-9]+\\.[0-9]+)" GAWK_AUTOMAKE_LINE_VERSION "${CONFIG_AUTOMAKE}") STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GAWK_MAJOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") -- cgit v1.2.3 From 08fc54511a406a767652b617f9c8e293e794258a Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 17 Feb 2013 15:12:46 +0100 Subject: Pass a few more defined via config.h. --- cmake/configure.cmake | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index a4f3161f..b0640706 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -56,6 +56,11 @@ MACRO(DefineConfigH feature) endif () ENDMACRO(DefineConfigH) +MACRO(DefineConfigHValue feature value) + set(${feature} ${value}) + DefineConfigH(${feature}) +ENDMACRO(DefineConfigHValue) + MACRO(DefineFunctionIfAvailable func feature) check_function_exists("${func}" "${feature}") DefineConfigH(${feature}) @@ -92,16 +97,18 @@ STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GAWK_MAJOR_VERSION STRING( REGEX REPLACE ".*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" GAWK_MINOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") STRING( REGEX REPLACE ".*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" GAWK_BUGFIX_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") +# The definition for GAWK cannot be passed in config.he because +# the extensions will fail to build. add_definitions(-DGAWK) -set(GAWK_VERSION "${GAWK_MAJOR_VERSION}.${GAWK_MINOR_VERSION}.${GAWK_BUGFIX_VERSION}") -add_definitions(-D VERSION=\\"${GAWK_VERSION}\\") -add_definitions(-D PACKAGE=\\"gawk\\") -add_definitions(-D PACKAGE_STRING="GNU Awk ${GAWK_VERSION}") -add_definitions(-D PACKAGE_TARNAME=\\"gawk\\") -add_definitions(-D PACKAGE_URL=\\"http://www.gnu.org/software/gawk/\\") -add_definitions(-D PACKAGE_VERSION=\\"${GAWK_VERSION}\\") -add_definitions(-D DEFPATH=\\"${CMAKE_BINARY_DIR}/awk\\") -add_definitions(-D DEFLIBPATH=\\"${CMAKE_BINARY_DIR}/lib\\") +DefineConfigHValue(GAWK_VERSION "${GAWK_MAJOR_VERSION}.${GAWK_MINOR_VERSION}.${GAWK_BUGFIX_VERSION}") +DefineConfigHValue(VERSION \\"${GAWK_VERSION}\\") +DefineConfigHValue(PACKAGE \\"gawk\\") +DefineConfigHValue(PACKAGE_STRING "GNU Awk ${GAWK_VERSION}") +DefineConfigHValue(PACKAGE_TARNAME \\"gawk\\") +DefineConfigHValue(PACKAGE_URL \\"http://www.gnu.org/software/gawk/\\") +DefineConfigHValue(PACKAGE_VERSION \\"${GAWK_VERSION}\\") +DefineConfigHValue(DEFPATH \\"${CMAKE_BINARY_DIR}/awk\\") +DefineConfigHValue(DEFLIBPATH \\"${CMAKE_BINARY_DIR}/lib\\") #DefineFunctionIfAvailable(dlopen DYNAMIC) DefineHFileIfAvailable(dlfcn.h DYNAMIC) #add_definitions(-D SHLIBEXT=\\"${CMAKE_SHARED_LIBRARY_SUFFIX}\\") -- cgit v1.2.3 From a5f1cf2beb31002f3cd35bfef7cb8af8843fc2b5 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 17 Feb 2013 16:31:08 +0100 Subject: Moved all configuration stuff into cmake/configure.cmake so that config.h contains all settings. All 265 basic test cases pass now with USE_CONFIG_H set to ON. --- cmake/configure.cmake | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index b0640706..9e896284 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -237,3 +237,37 @@ DefineFunctionIfAvailable(mbrtowc HAVE_MBRTOWC) add_definitions(-D HAVE_STRINGIZE) add_definitions(-D _Noreturn=) +find_package(BISON REQUIRED) +if (${BISON_FOUND} STREQUAL "TRUE") + BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c) +endif() + +#http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:FindGettext +find_package(Gettext REQUIRED) +if (GETTEXT_FOUND STREQUAL "TRUE") + include_directories(${GETTEXT_INCLUDE_DIR}) +else () + message( FATAL_ERROR "Gettext not found" ) +endif() + +find_package(LATEX) +include(GNUInstallDirs) +include(GetPrerequisites) + +# For some unknown reason the defines for the extension +# are written into config.h only if they are implemented +# here and not in extension/CMakeLists.txt. +DefineLibraryIfAvailable(m sin "" HAVE_LIBM) +DefineLibraryIfAvailable(mpfr mpfr_add_si "" HAVE_MPFR) +DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS) +DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH) +DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H) +DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H) +DefineFunctionIfAvailable(getdtablesize HAVE_GETDTABLESIZE) +DefineFunctionIfAvailable(select HAVE_SELECT) +DefineFunctionIfAvailable(gettimeofday HAVE_GETTIMEOFDAY) +DefineHFileIfAvailable(sys/select.h HAVE_SYS_SELECT_H) +DefineFunctionIfAvailable(nanosleep HAVE_NANOSLEEP) +DefineHFileIfAvailable(time.h HAVE_TIME_H) +DefineFunctionIfAvailable(GetSystemTimeAsFileTime HAVE_GETSYSTEMTIMEASFILETIME) + -- cgit v1.2.3 From 13eee814c9d9e5c7b4cf0e0f55c23951fec443f2 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 17 Feb 2013 21:58:56 +0100 Subject: USE_CONFIG_H is now ON be default. Found clean implementation for DYNAMIC and SHLIBEXT. --- cmake/configure.cmake | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 9e896284..38265b98 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -24,7 +24,7 @@ ## process this file with CMake to produce Makefile -option (USE_CONFIG_H "Generate a file config.h for inclusion into C source code" OFF) +option (USE_CONFIG_H "Generate a file config.h for inclusion into C source code" ON) if (USE_CONFIG_H) file( WRITE config.h "/* all settings defined by CMake. */\n\n" ) ADD_DEFINITIONS (-D HAVE_CONFIG_H) @@ -109,10 +109,19 @@ DefineConfigHValue(PACKAGE_URL \\"http://www.gnu.org/software/gawk/\\") DefineConfigHValue(PACKAGE_VERSION \\"${GAWK_VERSION}\\") DefineConfigHValue(DEFPATH \\"${CMAKE_BINARY_DIR}/awk\\") DefineConfigHValue(DEFLIBPATH \\"${CMAKE_BINARY_DIR}/lib\\") -#DefineFunctionIfAvailable(dlopen DYNAMIC) -DefineHFileIfAvailable(dlfcn.h DYNAMIC) -#add_definitions(-D SHLIBEXT=\\"${CMAKE_SHARED_LIBRARY_SUFFIX}\\") -add_definitions(-D SHLIBEXT=\\"so\\") +if (CMAKE_DL_LIBS) + message(STATUS "Found CMAKE_DL_LIBS:${CMAKE_DL_LIBS}") + DefineConfigHValue(DYNAMIC 1) +else() + message(STATUS "Found no CMAKE_DL_LIBS") +endif() +if (CMAKE_SHARED_LIBRARY_SUFFIX) + STRING( REGEX REPLACE "^(\\.)([a-zA-Z0-9])" "\\2" SHLIBEXT "${CMAKE_SHARED_LIBRARY_SUFFIX}") + DefineConfigHValue(SHLIBEXT \\"${SHLIBEXT}\\") + message(STATUS "Found SHLIBEXT: ${SHLIBEXT}") +else() + message(STATUS "Found no SHLIBEXT") +endif() DefineTypeIfAvailable("unsigned int" SIZEOF_UNSIGNED_INT) DefineTypeIfAvailable("unsigned long" SIZEOF_UNSIGNED_LONG) #/* Define to 1 if *printf supports %F format */ -- cgit v1.2.3 From f4eb81006930f3d2fe944298b63bb546f0ee3e9f Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Mon, 18 Feb 2013 18:35:09 +0100 Subject: Testing, documentation, gettext and bison only on UNIX-based systems. --- cmake/Toolchain_generic.cmake | 2 +- cmake/Toolchain_mingw32.cmake | 2 +- cmake/configure.cmake | 40 ++++++++++++++++++++++------------------ 3 files changed, 24 insertions(+), 20 deletions(-) (limited to 'cmake') diff --git a/cmake/Toolchain_generic.cmake b/cmake/Toolchain_generic.cmake index bbd25593..91ddc6e7 100644 --- a/cmake/Toolchain_generic.cmake +++ b/cmake/Toolchain_generic.cmake @@ -10,7 +10,7 @@ SET(CMAKE_C_COMPILER /usr/bin/gcc) # here is the target environment located # Settings for Ubuntu 12.04.1 LTS -SET(CMAKE_FIND_ROOT_PATH /usr/include) +SET(CMAKE_FIND_ROOT_PATH /usr/) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search diff --git a/cmake/Toolchain_mingw32.cmake b/cmake/Toolchain_mingw32.cmake index 8f1d2fbd..bb885f2f 100644 --- a/cmake/Toolchain_mingw32.cmake +++ b/cmake/Toolchain_mingw32.cmake @@ -12,7 +12,7 @@ SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres) # here is the target environment located # Settings for Ubuntu 12.04.1 LTS -SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/i686-w64-mingw32/include) +SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 38265b98..cd66e24b 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -143,13 +143,15 @@ DefineHFileIfAvailable(stdint.h HAVE_STDINT_H) DefineHFileIfAvailable(inttypes.h HAVE_INTTYPES_H) DefineHFileIfAvailable(stdlib.h HAVE_STDLIB_H) DefineHFileIfAvailable(unistd.h HAVE_UNISTD_H) -DefineFunctionIfAvailable(gettext HAVE_GETTEXT) -DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT) +if (CMAKE_HOST_UNIX) + DefineFunctionIfAvailable(gettext HAVE_GETTEXT) + DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT) FIND_PACKAGE(Gettext REQUIRED) -# FIND_PACKAGE(XGettext REQUIRED) -# FIND_PACKAGE(Iconv REQUIRED) + # FIND_PACKAGE(XGettext REQUIRED) + # FIND_PACKAGE(Iconv REQUIRED) FIND_PATH(INTL_INCLUDE_DIR libintl.h PATHS /usr/include /usr/local/include) FIND_LIBRARY(INTL_LIBRARIES intl c PATHS /usr/lib/ /usr/local/lib) +endif() DefineSymbolIfAvailable("CODESET" "langinfo.h" HAVE_LANGINFO_CODESET) DefineSymbolIfAvailable("LC_MESSAGES" "locale.h" HAVE_LC_MESSAGES) DefineTypeIfAvailable("_Bool" HAVE__BOOL) @@ -246,22 +248,24 @@ DefineFunctionIfAvailable(mbrtowc HAVE_MBRTOWC) add_definitions(-D HAVE_STRINGIZE) add_definitions(-D _Noreturn=) -find_package(BISON REQUIRED) -if (${BISON_FOUND} STREQUAL "TRUE") - BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c) -endif() +if (CMAKE_HOST_UNIX) + find_package(BISON REQUIRED) + if (${BISON_FOUND} STREQUAL "TRUE") + BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c) + endif() -#http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:FindGettext -find_package(Gettext REQUIRED) -if (GETTEXT_FOUND STREQUAL "TRUE") - include_directories(${GETTEXT_INCLUDE_DIR}) -else () - message( FATAL_ERROR "Gettext not found" ) -endif() + #http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:FindGettext + find_package(Gettext REQUIRED) + if (GETTEXT_FOUND STREQUAL "TRUE") + include_directories(${GETTEXT_INCLUDE_DIR}) + else () + message( FATAL_ERROR "Gettext not found" ) + endif() -find_package(LATEX) -include(GNUInstallDirs) -include(GetPrerequisites) + find_package(LATEX) + include(GNUInstallDirs) + include(GetPrerequisites) +endif() # For some unknown reason the defines for the extension # are written into config.h only if they are implemented -- cgit v1.2.3 From 284608d0645dcb90d0a443f155bb9e513eaf9eff Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Mon, 18 Feb 2013 19:28:36 +0100 Subject: Preparations for building an NSIS installer. --- cmake/package.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/package.cmake b/cmake/package.cmake index 27fe285d..ffea3f04 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -24,7 +24,14 @@ ## process this file with CMake to produce Makefile -SET(CPACK_GENERATOR "TGZ") +IF (WIN32) + SET(CPACK_GENERATOR "NSIS") + set(CPACK_NSIS_INSTALL_ROOT "C:") +ELSE() + SET(CPACK_GENERATOR "TGZ") + SET(CPACK_PACKAGING_INSTALL_PREFIX /usr) +ENDIF() + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is GNU Awk ${GAWK_VERSION}") SET(CPACK_PACKAGE_NAME "gawk") SET(CPACK_PACKAGE_VERSION "${GAWK_VERSION}") @@ -33,6 +40,5 @@ SET(CPACK_PACKAGE_VERSION_MINOR "${GAWK_MINOR_VERSION}") SET(CPACK_PACKAGE_VERSION_PATCH "${GAWK_BUGFIX_VERSION}") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README") -SET(CPACK_PACKAGING_INSTALL_PREFIX /usr) INCLUDE(CPack) -- cgit v1.2.3 From 6c173e43fc3902e5dc4be1ed90aac7a66228628e Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Wed, 20 Feb 2013 19:49:19 +0100 Subject: Added instructions on building with MinGW on Ubuntu 12.04. --- cmake/package.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/package.cmake b/cmake/package.cmake index ffea3f04..7bbb1373 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -26,7 +26,7 @@ IF (WIN32) SET(CPACK_GENERATOR "NSIS") - set(CPACK_NSIS_INSTALL_ROOT "C:") + set(CPACK_NSIS_INSTALL_ROOT "C:/Programs") ELSE() SET(CPACK_GENERATOR "TGZ") SET(CPACK_PACKAGING_INSTALL_PREFIX /usr) -- cgit v1.2.3 From a0283cb5e4c3191db16fc9b48d0ff05f660ef3ae Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Thu, 21 Feb 2013 08:50:50 +0100 Subject: CMake can now use the clang compiler (supplied by the llvm project) to build gawk. --- cmake/Toolchain_clang.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cmake/Toolchain_clang.cmake (limited to 'cmake') diff --git a/cmake/Toolchain_clang.cmake b/cmake/Toolchain_clang.cmake new file mode 100644 index 00000000..9784db41 --- /dev/null +++ b/cmake/Toolchain_clang.cmake @@ -0,0 +1,19 @@ +# http://www.cmake.org/Wiki/CmakeMingw +# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Clang) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER /usr/bin/clang) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH /usr/) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + -- cgit v1.2.3 From 83edcc2fccc61f50eb040af8b8227c31b0236336 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Thu, 21 Feb 2013 08:55:56 +0100 Subject: clang should use its own headers and libs. --- cmake/Toolchain_clang.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/Toolchain_clang.cmake b/cmake/Toolchain_clang.cmake index 9784db41..2c6bbbb5 100644 --- a/cmake/Toolchain_clang.cmake +++ b/cmake/Toolchain_clang.cmake @@ -8,7 +8,7 @@ SET(CMAKE_SYSTEM_NAME Clang) SET(CMAKE_C_COMPILER /usr/bin/clang) # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/) +SET(CMAKE_FIND_ROOT_PATH /usr/lib64/clang/3.1) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search -- cgit v1.2.3 From caab17cf55dfe1122a4e1955236492423ff1ca40 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Thu, 21 Feb 2013 11:46:42 +0100 Subject: NSIS installer gets a nice little icon. --- cmake/auk.ico | Bin 0 -> 5190 bytes cmake/package.cmake | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 cmake/auk.ico (limited to 'cmake') diff --git a/cmake/auk.ico b/cmake/auk.ico new file mode 100644 index 00000000..795ef1d9 Binary files /dev/null and b/cmake/auk.ico differ diff --git a/cmake/package.cmake b/cmake/package.cmake index 7bbb1373..a7ebe447 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -27,12 +27,18 @@ IF (WIN32) SET(CPACK_GENERATOR "NSIS") set(CPACK_NSIS_INSTALL_ROOT "C:/Programs") + set(CPACK_NSIS_MENU_LINKS "http://www.gnu.org/software/gawk" "GNU Awk") + set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico") + set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico") + set(CPACK_NSIS_CONTACT "bug-gawk@gnu.org") + set(CPACK_NSIS_DISPLAY_NAME "GNU Awk") ELSE() SET(CPACK_GENERATOR "TGZ") SET(CPACK_PACKAGING_INSTALL_PREFIX /usr) ENDIF() SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is GNU Awk ${GAWK_VERSION}") +set(CPACK_PACKAGE_VENDOR "GNU Project - Free Software Foundation (FSF)") SET(CPACK_PACKAGE_NAME "gawk") SET(CPACK_PACKAGE_VERSION "${GAWK_VERSION}") SET(CPACK_PACKAGE_VERSION_MAJOR "${GAWK_MAJOR_VERSION}") -- cgit v1.2.3 From 1e09bc8abf811e718a5ae77f6428bc31b1f4fdcb Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Thu, 21 Feb 2013 16:16:24 +0100 Subject: Added some more explanations. --- cmake/README.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt index 4e24cc1f..f4feaf7f 100644 --- a/cmake/README.txt +++ b/cmake/README.txt @@ -7,8 +7,10 @@ should do this, read Why the KDE project switched to CMake -- and how http://lwn.net/Articles/188693/ + Escape from GNU Autohell! + http://www.shlomifish.org/open-source/anti/autohell -- How can I get gawk compiled with CMake as fast as possible ? +- How can I get GNU Awk compiled with CMake as fast as possible ? git clone git://git.savannah.gnu.org/gawk.git cd gawk git checkout cmake @@ -55,3 +57,12 @@ but use a different build directory. When using CMake, do this: cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain_mingw32.cmake .. Write a new Toolchain file for your cross-compiler and use it. +- How can I build an installable file ? +Use "make package". The exact kind of installable file depends on your +operating system and defaults to TGZ. + +- Can I build an executable that runs on any Win32 platform ? +It is possible to build for the target Win32, but only with cross-compilers +on certain platforms. You need a MinGW cross-compiler and the NSIS package +builder. + -- cgit v1.2.3 From 698b17a3422b7b9cc1e4ab078ed7f26cfa30c463 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 23 Feb 2013 17:25:46 +0100 Subject: cmake -DCPACK_GENERATOR=DEB allows to produce packages in format of Debian or RPM based distributions. --- cmake/Toolchain_clang.cmake | 2 +- cmake/package.cmake | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'cmake') diff --git a/cmake/Toolchain_clang.cmake b/cmake/Toolchain_clang.cmake index 2c6bbbb5..89353570 100644 --- a/cmake/Toolchain_clang.cmake +++ b/cmake/Toolchain_clang.cmake @@ -2,7 +2,7 @@ # http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file # the name of the target operating system -SET(CMAKE_SYSTEM_NAME Clang) +SET(CMAKE_SYSTEM_NAME Generic) # which compilers to use for C and C++ SET(CMAKE_C_COMPILER /usr/bin/clang) diff --git a/cmake/package.cmake b/cmake/package.cmake index a7ebe447..62bf20e1 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -24,6 +24,17 @@ ## process this file with CMake to produce Makefile +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is GNU Awk ${GAWK_VERSION}") +set(CPACK_PACKAGE_VENDOR "GNU Project - Free Software Foundation (FSF)") +SET(CPACK_PACKAGE_NAME "gawk") +SET(CPACK_PACKAGE_VERSION "${GAWK_VERSION}") +SET(CPACK_PACKAGE_VERSION_MAJOR "${GAWK_MAJOR_VERSION}") +SET(CPACK_PACKAGE_VERSION_MINOR "${GAWK_MINOR_VERSION}") +SET(CPACK_PACKAGE_VERSION_PATCH "${GAWK_BUGFIX_VERSION}") +SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") +SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README") +set(CPACK_PACKAGE_CONTACT "bug-gawk@gnu.org") + IF (WIN32) SET(CPACK_GENERATOR "NSIS") set(CPACK_NSIS_INSTALL_ROOT "C:/Programs") @@ -33,18 +44,11 @@ IF (WIN32) set(CPACK_NSIS_CONTACT "bug-gawk@gnu.org") set(CPACK_NSIS_DISPLAY_NAME "GNU Awk") ELSE() - SET(CPACK_GENERATOR "TGZ") SET(CPACK_PACKAGING_INSTALL_PREFIX /usr) + IF(NOT CPACK_GENERATOR) + SET(CPACK_GENERATOR "TGZ") + ENDIF() + message(STATUS "CPACK_GENERATOR set to ${CPACK_GENERATOR}") ENDIF() -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is GNU Awk ${GAWK_VERSION}") -set(CPACK_PACKAGE_VENDOR "GNU Project - Free Software Foundation (FSF)") -SET(CPACK_PACKAGE_NAME "gawk") -SET(CPACK_PACKAGE_VERSION "${GAWK_VERSION}") -SET(CPACK_PACKAGE_VERSION_MAJOR "${GAWK_MAJOR_VERSION}") -SET(CPACK_PACKAGE_VERSION_MINOR "${GAWK_MINOR_VERSION}") -SET(CPACK_PACKAGE_VERSION_PATCH "${GAWK_BUGFIX_VERSION}") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") -SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README") - INCLUDE(CPack) -- cgit v1.2.3 From 119d46dcdfbc84058ea517ac1ec18bf3dbb26ec4 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 23 Feb 2013 18:29:03 +0100 Subject: .pdf files are now packaged into the doc directory. --- cmake/package.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/package.cmake b/cmake/package.cmake index 62bf20e1..b63c2863 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -37,7 +37,7 @@ set(CPACK_PACKAGE_CONTACT "bug-gawk@gnu.org") IF (WIN32) SET(CPACK_GENERATOR "NSIS") - set(CPACK_NSIS_INSTALL_ROOT "C:/Programs") + set(CPACK_NSIS_INSTALL_ROOT "C:") set(CPACK_NSIS_MENU_LINKS "http://www.gnu.org/software/gawk" "GNU Awk") set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico") set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico") -- cgit v1.2.3 From 451a255062f7e54bb6654ea8ea437cfbb4ec929d Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 9 Mar 2013 21:11:34 +0100 Subject: Dynamic extensions can be invoked now on Windows. DYNAMIC 1 will be set if CMAKE_SHARED_LIBRARY_SUFFIX exists (and not if CMAKE_DL_LIBS, as it was up to now). ext.c can now be compiled with DYNAMIC set because of include_directories(${CMAKE_SOURCE_DIR}/pc (thanks to Eli for the hint). --- cmake/configure.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index cd66e24b..d7e44cf7 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -97,8 +97,8 @@ STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GAWK_MAJOR_VERSION STRING( REGEX REPLACE ".*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" GAWK_MINOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") STRING( REGEX REPLACE ".*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" GAWK_BUGFIX_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") -# The definition for GAWK cannot be passed in config.he because -# the extensions will fail to build. +# The definition of the symbol GAWK cannot be passed in config.h +# because the extensions will fail to build. add_definitions(-DGAWK) DefineConfigHValue(GAWK_VERSION "${GAWK_MAJOR_VERSION}.${GAWK_MINOR_VERSION}.${GAWK_BUGFIX_VERSION}") DefineConfigHValue(VERSION \\"${GAWK_VERSION}\\") @@ -111,11 +111,11 @@ DefineConfigHValue(DEFPATH \\"${CMAKE_BINARY_DIR}/awk\\") DefineConfigHValue(DEFLIBPATH \\"${CMAKE_BINARY_DIR}/lib\\") if (CMAKE_DL_LIBS) message(STATUS "Found CMAKE_DL_LIBS:${CMAKE_DL_LIBS}") - DefineConfigHValue(DYNAMIC 1) else() message(STATUS "Found no CMAKE_DL_LIBS") endif() if (CMAKE_SHARED_LIBRARY_SUFFIX) + DefineConfigHValue(DYNAMIC 1) STRING( REGEX REPLACE "^(\\.)([a-zA-Z0-9])" "\\2" SHLIBEXT "${CMAKE_SHARED_LIBRARY_SUFFIX}") DefineConfigHValue(SHLIBEXT \\"${SHLIBEXT}\\") message(STATUS "Found SHLIBEXT: ${SHLIBEXT}") @@ -267,7 +267,7 @@ if (CMAKE_HOST_UNIX) include(GetPrerequisites) endif() -# For some unknown reason the defines for the extension +# For some unknown reason the defines for the extensions # are written into config.h only if they are implemented # here and not in extension/CMakeLists.txt. DefineLibraryIfAvailable(m sin "" HAVE_LIBM) -- cgit v1.2.3 From 3473e4d1cd41d32c1b902dd17e56977bf9051c2b Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Mon, 11 Mar 2013 08:53:22 +0100 Subject: Search for bison on all platforms and let it generate awkgram.c. Use existing awkgram.c otherwise. --- cmake/configure.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index d7e44cf7..ddb54b99 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -248,12 +248,17 @@ DefineFunctionIfAvailable(mbrtowc HAVE_MBRTOWC) add_definitions(-D HAVE_STRINGIZE) add_definitions(-D _Noreturn=) -if (CMAKE_HOST_UNIX) - find_package(BISON REQUIRED) - if (${BISON_FOUND} STREQUAL "TRUE") - BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c) - endif() +find_package(BISON QUIET) +# If there is a bison installed on this platform, +if (${BISON_FOUND} STREQUAL "TRUE") + # then let bison generate awkgram.c. + BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c) +else() + # otherwise use the existing awkgram.c. + set(BISON_awkgram_OUTPUTS ${CMAKE_SOURCE_DIR}/awkgram.c) +endif() +if (CMAKE_HOST_UNIX) #http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:FindGettext find_package(Gettext REQUIRED) if (GETTEXT_FOUND STREQUAL "TRUE") -- cgit v1.2.3 From 730a2388f18c57478fb0afa07b15947616f84c5a Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 19 Mar 2013 12:01:50 +0100 Subject: CMake can now compile for target S390 with embedian cross-compiler. --- cmake/Toolchain_s390.cmake | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 cmake/Toolchain_s390.cmake (limited to 'cmake') diff --git a/cmake/Toolchain_s390.cmake b/cmake/Toolchain_s390.cmake new file mode 100644 index 00000000..e1cdcfff --- /dev/null +++ b/cmake/Toolchain_s390.cmake @@ -0,0 +1,20 @@ +# http://www.cmake.org/Wiki/CmakeMingw +# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file +# http://wiki.debian.org/EmdebianToolchain#Get_the_binaries + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Generic) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER /usr/bin/s390-linux-gnu-gcc-4.4) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH /usr/s390-linux-gnu/) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + -- cgit v1.2.3 From 74db9f3cb12c4c45487b8646473daad7d0df641f Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 28 Apr 2013 19:23:08 +0200 Subject: On Win32 platforms a native build with MinGW works now. --- cmake/README.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt index f4feaf7f..60dde159 100644 --- a/cmake/README.txt +++ b/cmake/README.txt @@ -62,7 +62,20 @@ Use "make package". The exact kind of installable file depends on your operating system and defaults to TGZ. - Can I build an executable that runs on any Win32 platform ? -It is possible to build for the target Win32, but only with cross-compilers -on certain platforms. You need a MinGW cross-compiler and the NSIS package -builder. +Yes, there are two ways of doing this. +In both cases you need a MinGW compiler and the NSIS package builder +installed on the host that shall do the build. + http://sourceforge.net/projects/mingw + http://sourceforge.net/projects/nsis +When installed properly, the NSIS tool can even build an installer file +(a single .exe file that unpacks, registers and installs the gawk executable +and several other files). +1. way: native build on a Win32 platform + http://www.cmake.org/cmake/help/runningcmake.html + After clicking "Configure" select the MinGW option with the default native compiler + In the build directory, the command "mingw32-make" will build the gawk.exe + The command "mingw32-make package" will build installer file +2. way: build with cross-compiler on a Linux platform like Ubuntu 12.04 LTS + Proceed as describe above for cross-compilers. + The command "make ; make package" will build gawk.exe and the installer file -- cgit v1.2.3 From b6dbba36f373166e14cad2767b89d0331b8ac77c Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Mon, 29 Apr 2013 18:14:06 +0200 Subject: When building with a native MinGW for Win32 it is now possible to run a 'make test'; only 90% of the basic test cases pass. --- cmake/basictest | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 42cb2864..95b98a12 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -1,5 +1,6 @@ #!/bin/sh +export PATH=$PATH:/c/MinGW/msys/1.0/bin TESTHOME=$(dirname ${0})/../test export AWKPATH=${TESTHOME} export AWKLIBPATH=${TESTHOME}/../build/extension/ @@ -10,5 +11,13 @@ then else $1 $3 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} fi -cmp ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} +# Is this shell running in a native MinGW shell (MSYS) ? +if test -n "$COMSPEC"; then + # Ignore all differences in white space. + COMPARE="diff -w" +else + # This is a shell running in Unix environment. + COMPARE="cmp" +fi +${COMPARE} ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} -- cgit v1.2.3 From 871c74808578617fdf6dab0ee5b28b9c7d00aaae Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Mon, 29 Apr 2013 19:21:17 +0200 Subject: Native MinGW can now run tests with dynamic extensions; only a few of them pass. --- cmake/basictest | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 95b98a12..56b530de 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -2,15 +2,8 @@ export PATH=$PATH:/c/MinGW/msys/1.0/bin TESTHOME=$(dirname ${0})/../test -export AWKPATH=${TESTHOME} -export AWKLIBPATH=${TESTHOME}/../build/extension/ +export AWKLIBPATH=$(dirname ${1})/extension/ export LANG=C -if test -r ${TESTHOME}/${2}.in -then - $1 $3 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} -else - $1 $3 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} -fi # Is this shell running in a native MinGW shell (MSYS) ? if test -n "$COMSPEC"; then # Ignore all differences in white space. @@ -19,5 +12,11 @@ else # This is a shell running in Unix environment. COMPARE="cmp" fi +if test -r ${TESTHOME}/${2}.in +then + $1 $3 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} +else + $1 $3 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} +fi ${COMPARE} ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} -- cgit v1.2.3 From b6a5e7aa9d0e8b125fc885168f9a8b63bc0f7758 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 30 Apr 2013 12:18:24 +0200 Subject: Cleaned up some more auto-detection macros. --- cmake/basictest | 1 + cmake/configure.cmake | 20 ++++++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 56b530de..575f1c87 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -2,6 +2,7 @@ export PATH=$PATH:/c/MinGW/msys/1.0/bin TESTHOME=$(dirname ${0})/../test +export AWKPATH=${TESTHOME} export AWKLIBPATH=$(dirname ${1})/extension/ export LANG=C # Is this shell running in a native MinGW shell (MSYS) ? diff --git a/cmake/configure.cmake b/cmake/configure.cmake index ddb54b99..7bc27be6 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -179,22 +179,19 @@ DefineHFileIfAvailable(sys/termios.h HAVE_TERMIOS_H) DefineHFileIfAvailable(stropts.h HAVE_STROPTS_H) DefineHFileIfAvailable(wchar.h HAVE_WCHAR_H) DefineHFileIfAvailable(wctype.h HAVE_WCTYPE_H) -#DefineTypeIfAvailable("long long int" HAVE_LONG_LONG_INT) -#add_definitions(-D HAVE_UNSIGNED_LONG_LONG_INT) +DefineTypeIfAvailable("long long int" HAVE_LONG_LONG_INT) +DefineTypeIfAvailable("unsigned long long int" HAVE_UNSIGNED_LONG_LONG_INT) DefineTypeIfAvailable(intmax_t INTMAX_T) DefineTypeIfAvailable(uintmax_t UINTMAX_T) # Some of these dont work, maybe CheckCSourceCompiles would be better. DefineTypeIfAvailable("time_t" TIME_T_IN_SYS_TYPES_H) DefineTypeIfAvailable("wctype_t" WCTYPE_T) -add_definitions(-D WINT_T) -#DefineTypeIfAvailable("wint_t" WINT_T) -add_definitions(-D HAVE_SOCKADDR_STORAGE) -#DefineTypeIfAvailable("struct sockaddr_storage" SOCKADDR_STORAGE) -add_definitions(-D HAVE_STRUCT_STAT_ST_BLKSIZE) -#DefineStructHasMemberIfAvailable("struct stat" st_blksize bits/stat.h HAVE_STRUCT_STAT_ST_BLKSIZE) -add_definitions(-D HAVE_ST_BLKSIZE) -#DefineStructHasMemberIfAvailable("struct stat" st_blksize bits/stat.h HAVE_ST_BLKSIZE) +#add_definitions(-D WINT_T) +DefineTypeIfAvailable("wint_t" WINT_T) +DefineStructHasMemberIfAvailable("struct sockaddr_storage" ss_family sys/socket.h HAVE_SOCKADDR_STORAGE) +DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_STRUCT_STAT_ST_BLKSIZE) +DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_ST_BLKSIZE) DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_TM_ZONE) DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZONE) @@ -204,8 +201,7 @@ DefineFunctionIfAvailable(mktime HAVE_MKTIME) DefineFunctionIfAvailable(getaddrinfo HAVE_GETADDRINFO) DefineFunctionIfAvailable(atexit HAVE_ATEXIT) DefineFunctionIfAvailable(btowc HAVE_BTOWC) -add_definitions(-D HAVE_FMOD) -#DefineFunctionIfAvailable(fmod HAVE_FMOD) +DefineFunctionIfAvailable(fmod HAVE_FMOD) DefineFunctionIfAvailable(isinf HAVE_ISINF) DefineFunctionIfAvailable(ismod HAVE_ISMOD) DefineFunctionIfAvailable(getgrent HAVE_GETGRENT) -- cgit v1.2.3 From 5c5a827839987b36fc8f0fc3003d745d0923814b Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 30 Apr 2013 18:57:40 +0200 Subject: Extension readdir can now be built; now the extensions are complete. --- cmake/configure.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 7bc27be6..642b15e8 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -277,6 +277,7 @@ DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS) DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH) DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H) DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H) +DefineFunctionIfAvailable(dirfd HAVE_DIRFD) DefineFunctionIfAvailable(getdtablesize HAVE_GETDTABLESIZE) DefineFunctionIfAvailable(select HAVE_SELECT) DefineFunctionIfAvailable(gettimeofday HAVE_GETTIMEOFDAY) -- cgit v1.2.3 From 30826905fb5989599ee4313e1d4af584ac478fb4 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 30 Apr 2013 19:56:19 +0200 Subject: New macro DefineIfSourceCompiles helps in auto-detection of wint_t. --- cmake/configure.cmake | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 642b15e8..2f0823e4 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -43,6 +43,7 @@ include(CheckFunctionExists) include(CheckLibraryExists) include(CheckTypeSize) include(CheckStructHasMember) +INCLUDE(CheckCSourceCompiles) MACRO(DefineConfigH feature) # message(STATUS feature=${feature}=${${feature}}) @@ -91,6 +92,11 @@ MACRO(DefineLibraryIfAvailable lib func location feature) DefineConfigH(${feature}) ENDMACRO(DefineLibraryIfAvailable) +MACRO(DefineIfSourceCompiles source feature) + check_c_source_compiles( "${source}" "${feature}") + DefineConfigH(${feature}) +ENDMACRO(DefineIfSourceCompiles) + FILE( READ configure.ac CONFIG_AUTOMAKE ) STRING( REGEX MATCH "AC_INIT\\(\\[GNU Awk\\], ([0-9]+\\.[0-9]+\\.[0-9]+)" GAWK_AUTOMAKE_LINE_VERSION "${CONFIG_AUTOMAKE}") STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GAWK_MAJOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}") @@ -187,8 +193,16 @@ DefineTypeIfAvailable(uintmax_t UINTMAX_T) # Some of these dont work, maybe CheckCSourceCompiles would be better. DefineTypeIfAvailable("time_t" TIME_T_IN_SYS_TYPES_H) DefineTypeIfAvailable("wctype_t" WCTYPE_T) -#add_definitions(-D WINT_T) -DefineTypeIfAvailable("wint_t" WINT_T) +# Detection of wint_t works but in an unsatisfying way. +DefineIfSourceCompiles( + "#include \"wchar.h\" + static void testcb(wint_t w) { } + int main() { + wint_t w = 0; + testcb(w); + return 0; + }" + HAVE_WINT_T) DefineStructHasMemberIfAvailable("struct sockaddr_storage" ss_family sys/socket.h HAVE_SOCKADDR_STORAGE) DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_STRUCT_STAT_ST_BLKSIZE) DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_ST_BLKSIZE) -- cgit v1.2.3 From e58a44a35b0c64d8072d4663b68a5cfdebc6a83b Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 30 Apr 2013 20:30:42 +0200 Subject: Found a clean way to auto-detect wctype_t and wint_t. --- cmake/configure.cmake | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 2f0823e4..1c74bc5c 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -189,20 +189,12 @@ DefineTypeIfAvailable("long long int" HAVE_LONG_LONG_INT) DefineTypeIfAvailable("unsigned long long int" HAVE_UNSIGNED_LONG_LONG_INT) DefineTypeIfAvailable(intmax_t INTMAX_T) DefineTypeIfAvailable(uintmax_t UINTMAX_T) - -# Some of these dont work, maybe CheckCSourceCompiles would be better. DefineTypeIfAvailable("time_t" TIME_T_IN_SYS_TYPES_H) -DefineTypeIfAvailable("wctype_t" WCTYPE_T) -# Detection of wint_t works but in an unsatisfying way. -DefineIfSourceCompiles( - "#include \"wchar.h\" - static void testcb(wint_t w) { } - int main() { - wint_t w = 0; - testcb(w); - return 0; - }" - HAVE_WINT_T) +SET(CMAKE_EXTRA_INCLUDE_FILES wctype.h) +DefineTypeIfAvailable("wctype_t" HAVE_WCTYPE_T) +DefineTypeIfAvailable("wint_t" HAVE_WINT_T) +SET(CMAKE_EXTRA_INCLUDE_FILES) + DefineStructHasMemberIfAvailable("struct sockaddr_storage" ss_family sys/socket.h HAVE_SOCKADDR_STORAGE) DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_STRUCT_STAT_ST_BLKSIZE) DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_ST_BLKSIZE) -- cgit v1.2.3 From b04f6c730f608e853f84c6e2c77d018039a3a693 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Wed, 1 May 2013 12:12:16 +0200 Subject: Auto-detection is now mostly free from explicite conditionals. --- cmake/configure.cmake | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 1c74bc5c..ec4c4e52 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -149,15 +149,8 @@ DefineHFileIfAvailable(stdint.h HAVE_STDINT_H) DefineHFileIfAvailable(inttypes.h HAVE_INTTYPES_H) DefineHFileIfAvailable(stdlib.h HAVE_STDLIB_H) DefineHFileIfAvailable(unistd.h HAVE_UNISTD_H) -if (CMAKE_HOST_UNIX) - DefineFunctionIfAvailable(gettext HAVE_GETTEXT) - DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT) - FIND_PACKAGE(Gettext REQUIRED) - # FIND_PACKAGE(XGettext REQUIRED) - # FIND_PACKAGE(Iconv REQUIRED) - FIND_PATH(INTL_INCLUDE_DIR libintl.h PATHS /usr/include /usr/local/include) - FIND_LIBRARY(INTL_LIBRARIES intl c PATHS /usr/lib/ /usr/local/lib) -endif() +FIND_PATH(INTL_INCLUDE_DIR libintl.h PATHS /usr/include /usr/local/include) +FIND_LIBRARY(INTL_LIBRARIES intl c PATHS /usr/lib/ /usr/local/lib) DefineSymbolIfAvailable("CODESET" "langinfo.h" HAVE_LANGINFO_CODESET) DefineSymbolIfAvailable("LC_MESSAGES" "locale.h" HAVE_LC_MESSAGES) DefineTypeIfAvailable("_Bool" HAVE__BOOL) @@ -203,6 +196,7 @@ DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZO DefineHFileIfAvailable(sys/time.h HAVE_SYS_TIME_H) DefineFunctionIfAvailable(alarm HAVE_ALARM) +DefineFunctionIfAvailable(tzname HAVE_DECL_TZNAME) DefineFunctionIfAvailable(mktime HAVE_MKTIME) DefineFunctionIfAvailable(getaddrinfo HAVE_GETADDRINFO) DefineFunctionIfAvailable(atexit HAVE_ATEXIT) @@ -214,11 +208,12 @@ DefineFunctionIfAvailable(getgrent HAVE_GETGRENT) DefineFunctionIfAvailable(getgroups HAVE_GETGROUPS) add_definitions(-D GETGROUPS_T=gid_t) DefineTypeIfAvailable("pid_t" PID_T) +DefineTypeIfAvailable("intmax_t" HAVE_INTMAX_T) DefineFunctionIfAvailable(grantpt HAVE_GRANTPT) DefineFunctionIfAvailable(isascii HAVE_ISASCII) DefineFunctionIfAvailable(iswctype HAVE_ISWCTYPE) DefineFunctionIfAvailable(iswlower HAVE_ISWLOWER) -DefineFunctionIfAvailable(iswupper HAVE_ISUPPER) +DefineFunctionIfAvailable(iswupper HAVE_ISWUPPER) DefineFunctionIfAvailable(mbrlen HAVE_MBRLEN) DefineFunctionIfAvailable(memcmp HAVE_MEMCMP) DefineFunctionIfAvailable(memcpy HAVE_MEMCPY) @@ -260,20 +255,19 @@ else() set(BISON_awkgram_OUTPUTS ${CMAKE_SOURCE_DIR}/awkgram.c) endif() -if (CMAKE_HOST_UNIX) - #http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:FindGettext - find_package(Gettext REQUIRED) - if (GETTEXT_FOUND STREQUAL "TRUE") - include_directories(${GETTEXT_INCLUDE_DIR}) - else () - message( FATAL_ERROR "Gettext not found" ) - endif() - - find_package(LATEX) - include(GNUInstallDirs) - include(GetPrerequisites) +find_package(Gettext REQUIRED) +if (GETTEXT_FOUND STREQUAL "TRUE") + include_directories(${GETTEXT_INCLUDE_DIR}) + DefineFunctionIfAvailable(gettext HAVE_GETTEXT) + DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT) +else () + message( FATAL_ERROR "Gettext not found" ) endif() +find_package(LATEX) +include(GNUInstallDirs) +include(GetPrerequisites) + # For some unknown reason the defines for the extensions # are written into config.h only if they are implemented # here and not in extension/CMakeLists.txt. -- cgit v1.2.3 From 582c08d3795cec69eae28f9513c65d21ad0a13e8 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 4 May 2013 12:02:15 +0200 Subject: Non-standard test cases like testext shall be implemented as shell functions. --- cmake/basictest | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 575f1c87..5e9010a0 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -1,9 +1,18 @@ #!/bin/sh +# Use this for debugging the test cases. +# The resulting textual output will not destroy the test cases. +set -x +# After test case execution, the output can be found in +# build/Testing/Temporary/LastTest.log + export PATH=$PATH:/c/MinGW/msys/1.0/bin +export GAWKEXE=$1 +export TESTCASE=$2 +export OPTION=$3 TESTHOME=$(dirname ${0})/../test export AWKPATH=${TESTHOME} -export AWKLIBPATH=$(dirname ${1})/extension/ +export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/ export LANG=C # Is this shell running in a native MinGW shell (MSYS) ? if test -n "$COMSPEC"; then @@ -13,11 +22,27 @@ else # This is a shell running in Unix environment. COMPARE="cmp" fi -if test -r ${TESTHOME}/${2}.in + +# Each test case that cannot be handle in the "standard way" shall +# be implemented as a function here. +function testext() { + $GAWKEXE '/^(@load|BEGIN)/,/^}/' ${TESTHOME}/../extension/testext.c > testext.awk + $GAWKEXE -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} + rm -f testext.awk +} + +# Is this test case implemented as a function ? +if [ "$( type -t $TESTCASE )" = "function" ] +then + $TESTCASE +# If no function exists, then treat the test case in standard way. +elif test -r ${TESTHOME}/${TESTCASE}.in +# Any existing .in file will be redirected to standard input. then - $1 $3 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $GAWKEXE ${OPTION} -f ${TESTCASE}.awk < ${TESTHOME}/${TESTCASE}.in > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} else - $1 $3 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} fi -${COMPARE} ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} +# Compare the actual output with the expected (correct) output. +${COMPARE} ${TESTHOME}/${TESTCASE}.ok ${TESTHOME}/_${TESTCASE} && rm -f ${TESTHOME}/_${TESTCASE} -- cgit v1.2.3 From e081fb5a615104d2ac8ec6b193ce3106950a3bbb Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 4 May 2013 16:37:29 +0200 Subject: All SHLIB test cases are implemented now and pass on Linux. With MinGW only 6 of them pass. --- cmake/basictest | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 9 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 5e9010a0..211491f6 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -10,9 +10,10 @@ export PATH=$PATH:/c/MinGW/msys/1.0/bin export GAWKEXE=$1 export TESTCASE=$2 export OPTION=$3 -TESTHOME=$(dirname ${0})/../test -export AWKPATH=${TESTHOME} -export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/ +TOPSRCDIR=$(dirname ${0})/.. +SRCDIR=${TOPSRCDIR}/test +export AWKPATH=${SRCDIR} +export AWKLIBPATH=$(dirname ${GAWKEXE})extension/ export LANG=C # Is this shell running in a native MinGW shell (MSYS) ? if test -n "$COMSPEC"; then @@ -25,10 +26,73 @@ fi # Each test case that cannot be handle in the "standard way" shall # be implemented as a function here. + +function inplace1() { + cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1 + cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2 + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2 +} + +function inplace2() { + cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1 + cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2 + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak + ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2 + ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak +} + +function inplace3() { + cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1 + cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2 + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >>_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak + ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2 + ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak +} + function testext() { - $GAWKEXE '/^(@load|BEGIN)/,/^}/' ${TESTHOME}/../extension/testext.c > testext.awk - $GAWKEXE -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} + $GAWKEXE ' /^(@load|BEGIN)/,/^}/' ${SRCDIR}/../extension/testext.c > testext.awk + $GAWKEXE -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE} rm -f testext.awk + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} +} + +function readdir() { + if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { print $$NF }'`" = nfs ]; then + echo This test may fail on GNU/Linux systems when run on an NFS filesystem.; + echo If it does, try rerunning on an ext'[234]' filesystem. ; + fi + $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/.. > ${SRCDIR}/_${TESTCASE} 2>&1 + ls -afli ${TOPSRCDIR} | sed 1d | $GAWKEXE -f ${SRCDIR}/readdir0.awk -v extout=${SRCDIR}/_${TESTCASE} > ${SRCDIR}/${TESTCASE}.ok + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} +} + +function ordchr2() { + $GAWKEXE -l ordchr 'BEGIN {print chr(ord("z"))}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function readfile() { + $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + ${COMPARE} Makefile _${TESTCASE} && rm -f _${TESTCASE} || cp -p Makefile ${TESTCASE}.ok +} + +function fts() { + if [ "`uname`" = IRIX ]; then \ + echo This test may fail on IRIX systems when run on an NFS filesystem.; \ + echo If it does, try rerunning on an xfs filesystem. ; \ + fi + ( cd ${SRCDIR} ; $GAWKEXE -f ${TESTCASE}.awk ) + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} } # Is this test case implemented as a function ? @@ -36,13 +100,15 @@ if [ "$( type -t $TESTCASE )" = "function" ] then $TESTCASE # If no function exists, then treat the test case in standard way. -elif test -r ${TESTHOME}/${TESTCASE}.in +elif test -r ${SRCDIR}/${TESTCASE}.in # Any existing .in file will be redirected to standard input. then - $GAWKEXE ${OPTION} -f ${TESTCASE}.awk < ${TESTHOME}/${TESTCASE}.in > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} + $GAWKEXE ${OPTION} -f ${TESTCASE}.awk < ${SRCDIR}/${TESTCASE}.in > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} else - $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} + $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} fi # Compare the actual output with the expected (correct) output. -${COMPARE} ${TESTHOME}/${TESTCASE}.ok ${TESTHOME}/_${TESTCASE} && rm -f ${TESTHOME}/_${TESTCASE} +#${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} -- cgit v1.2.3 From bbbdcd5cec911cdef6e8e82c6000b10dabafacae Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 4 May 2013 19:48:44 +0200 Subject: All non-standard test cases that caused a hang are now in and pass; (altogether 309 out of 377 pass). --- cmake/basictest | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 211491f6..13f9f81c 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -13,7 +13,7 @@ export OPTION=$3 TOPSRCDIR=$(dirname ${0})/.. SRCDIR=${TOPSRCDIR}/test export AWKPATH=${SRCDIR} -export AWKLIBPATH=$(dirname ${GAWKEXE})extension/ +export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/ export LANG=C # Is this shell running in a native MinGW shell (MSYS) ? if test -n "$COMSPEC"; then @@ -27,6 +27,59 @@ fi # Each test case that cannot be handle in the "standard way" shall # be implemented as a function here. +function getline2() { + $GAWKEXE -f ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function litoct() { + echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function nonl() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f nonl.awk /dev/null >_${TESTCASE} 2>&1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function poundbang() { +# The original poundbang test case looks a bit non-deterministic. +# This is a shortened version. + sed "s;/tmp/gawk;$GAWKEXE;" < ${SRCDIR}/poundbang.awk > ./_pbd.awk + chmod +x ./_pbd.awk + ./_pbd.awk ${SRCDIR}/poundbang.awk > _`basename ${TESTCASE}` ; + ${COMPARE} ${SRCDIR}/poundbang.awk _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` _pbd.awk +} + +function beginfile1() { + AWKPATH=${SRCDIR} $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.awk . ./no/such/file Makefile >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function manyfiles() { + rm -rf junk + mkdir junk + $GAWKEXE 'BEGIN { for (i = 1; i <= 1030; i++) print i, i}' >_${TESTCASE} + $GAWKEXE -f ${SRCDIR}/manyfiles.awk _${TESTCASE} _${TESTCASE} + wc -l junk/* | $GAWKEXE '$1 != 2' | wc -l | sed "s/ *//g" > _${TESTCASE} + rm -rf junk + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function rsstart2() { + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/rsstart1.in >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function strftime() { + echo This test could fail on slow machines or on a minute boundary, + echo so if it does, double check the actual results: + GAWKLOCALE=C; export GAWKLOCALE + TZ=GMT0; export TZ + (LC_ALL=C date) | $GAWKEXE -v OUTPUT=_${TESTCASE} -f ${SRCDIR}/strftime.awk + ${COMPARE} strftime.ok _${TESTCASE} && rm -f _${TESTCASE} strftime.ok || exit 0 +} + function inplace1() { cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1 cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2 @@ -73,7 +126,7 @@ function readdir() { fi $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/.. > ${SRCDIR}/_${TESTCASE} 2>&1 ls -afli ${TOPSRCDIR} | sed 1d | $GAWKEXE -f ${SRCDIR}/readdir0.awk -v extout=${SRCDIR}/_${TESTCASE} > ${SRCDIR}/${TESTCASE}.ok - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok } function ordchr2() { @@ -92,7 +145,7 @@ function fts() { echo If it does, try rerunning on an xfs filesystem. ; \ fi ( cd ${SRCDIR} ; $GAWKEXE -f ${TESTCASE}.awk ) - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok } # Is this test case implemented as a function ? -- cgit v1.2.3 From 6855adcdcb8fd310b298043ace84f0cc9133c517 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 5 May 2013 12:26:02 +0200 Subject: Replaced some $$ with $. All MPFR test cases pass now, on Linux and with MinGW. --- cmake/basictest | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 13f9f81c..8652ee76 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -52,7 +52,7 @@ function poundbang() { } function beginfile1() { - AWKPATH=${SRCDIR} $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.awk . ./no/such/file Makefile >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + AWKPATH=${SRCDIR} $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.awk . ./no/such/file Makefile >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } @@ -83,7 +83,7 @@ function strftime() { function inplace1() { cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1 cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2 - AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1 ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2 @@ -92,7 +92,7 @@ function inplace1() { function inplace2() { cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1 cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2 - AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1 ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak @@ -103,8 +103,8 @@ function inplace2() { function inplace3() { cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1 cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2 - AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} - AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >>_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >>_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1 ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak @@ -120,7 +120,7 @@ function testext() { } function readdir() { - if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { print $$NF }'`" = nfs ]; then + if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { print $NF }'`" = nfs ]; then echo This test may fail on GNU/Linux systems when run on an NFS filesystem.; echo If it does, try rerunning on an ext'[234]' filesystem. ; fi @@ -130,12 +130,12 @@ function readdir() { } function ordchr2() { - $GAWKEXE -l ordchr 'BEGIN {print chr(ord("z"))}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + $GAWKEXE -l ordchr 'BEGIN {print chr(ord("z"))}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } function readfile() { - $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE} + $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} Makefile _${TESTCASE} && rm -f _${TESTCASE} || cp -p Makefile ${TESTCASE}.ok } @@ -148,6 +148,36 @@ function fts() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok } +function fmtspcl() { + $GAWKEXE -v "sd=${SRCDIR}" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < ${SRCDIR}/fmtspcl.tok > ${TESTCASE}.ok 2>/dev/null + $GAWKEXE $AWKFLAGS -f ${SRCDIR}/fmtspcl.awk --lint >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + if test -z "$AWKFLAGS" ; then + ${COMPARE} ${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + else + ${COMPARE} ${SRCDIR}/${TESTCASE}-mpfr.ok _${TESTCASE} && rm -f _${TESTCASE} + fi +} + +function mpfrexprange() { + $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function mpfrrnd() { + $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function mpfrnr() { + $GAWKEXE -M -vPREC=113 -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in > _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function mpfrbigint() { + $GAWKEXE -M -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + # Is this test case implemented as a function ? if [ "$( type -t $TESTCASE )" = "function" ] then -- cgit v1.2.3 From f6f37055efd53b08e22001776c6e223de78d7f54 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 5 May 2013 13:11:56 +0200 Subject: All EXT and INET test cases pass now. --- cmake/basictest | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 8652ee76..5c7b7eea 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -27,6 +27,19 @@ fi # Each test case that cannot be handle in the "standard way" shall # be implemented as a function here. +function regtest() { + echo 'Some of the output from regtest is very system specific, do not' + echo 'be distressed if your output differs from that distributed.' + echo 'Manual inspection is called for.' + AWK=$GAWKEXE ${SRCDIR}/regtest.sh +} + +function inftest() { + echo This test is very machine specific... + $GAWKEXE -f ${SRCDIR}/inftest.awk | sed "s/inf/Inf/g" >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function getline2() { $GAWKEXE -f ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -158,6 +171,28 @@ function fmtspcl() { fi } +function inetechu() { + echo This test is for establishing UDP connections + $GAWKEXE 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}' +} + +function inetecht() { + echo This test is for establishing TCP connections + $GAWKEXE 'BEGIN {print "" |& "/inet/tcp/0/127.0.0.1/9"}' +} + +function inetdayu() { + echo This test is for bidirectional UDP transmission + $GAWKEXE 'BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13"; \ + "/inet/udp/0/127.0.0.1/13" |& getline; print $0}' +} + +function inetdayt() { + echo This test is for bidirectional TCP transmission + $GAWKEXE 'BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13"; \ + "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}' +} + function mpfrexprange() { $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -- cgit v1.2.3 From 42100bbb008a4aa6088b77285777283e49339ae1 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 5 May 2013 15:56:08 +0200 Subject: All LOCALE_CHARSET test cases are in now and found a bug in multi-byte characters with FIELDWIDTHS. --- cmake/basictest | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 5c7b7eea..f7fc8653 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -64,6 +64,18 @@ function poundbang() { ${COMPARE} ${SRCDIR}/poundbang.awk _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` _pbd.awk } +function mbprintf1() { + GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function mbfw1() { + GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function beginfile1() { AWKPATH=${SRCDIR} $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.awk . ./no/such/file Makefile >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -213,6 +225,17 @@ function mpfrbigint() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function jarebug() { + ${SRCDIR}/${TESTCASE}.sh "$GAWKEXE" "${SRCDIR}/${TESTCASE}.awk" "${SRCDIR}/${TESTCASE}.in" "_${TESTCASE}" + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function rtlenmb() { + GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + ${SRCDIR}/rtlen.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + # Is this test case implemented as a function ? if [ "$( type -t $TESTCASE )" = "function" ] then -- cgit v1.2.3 From 188e4c22845855953c24b9ac26a86320371e1482 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 5 May 2013 17:04:38 +0200 Subject: All UNIX test cases are in now. --- cmake/basictest | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index f7fc8653..e77328a8 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -64,6 +64,11 @@ function poundbang() { ${COMPARE} ${SRCDIR}/poundbang.awk _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` _pbd.awk } +function localenl() { + ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} 2>/dev/null + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function mbprintf1() { GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} @@ -173,6 +178,24 @@ function fts() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok } +function fflush() { + ${SRCDIR}/fflush.sh >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function pid() { + AWKPATH=${SRCDIR} AWK=$GAWKEXE ${SHELL} ${SRCDIR}/pid.sh $$ > _`basename ${TESTCASE}` ; : + ${COMPARE} ${SRCDIR}/pid.ok _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` +} + +function strftlng() { + TZ=UTC; export TZ; $GAWKEXE -f ${SRCDIR}/strftlng.awk >_${TESTCASE} + if ${COMPARE} ${SRCDIR}/strftlng.ok _${TESTCASE} >/dev/null 2>&1 ; then : ; else \ + TZ=UTC0; export TZ; $GAWKEXE -f ${SRCDIR}/strftlng.awk >_${TESTCASE} ; \ + fi + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function fmtspcl() { $GAWKEXE -v "sd=${SRCDIR}" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < ${SRCDIR}/fmtspcl.tok > ${TESTCASE}.ok 2>/dev/null $GAWKEXE $AWKFLAGS -f ${SRCDIR}/fmtspcl.awk --lint >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} @@ -183,6 +206,11 @@ function fmtspcl() { fi } +function pipeio2() { + $GAWKEXE -v SRCDIR=${SRCDIR} -f ${SRCDIR}/pipeio2.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function inetechu() { echo This test is for establishing UDP connections $GAWKEXE 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}' @@ -205,6 +233,11 @@ function inetdayt() { "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}' } +function space() { + $GAWKEXE -f ' ' ${SRCDIR}/space.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function mpfrexprange() { $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -230,6 +263,16 @@ function jarebug() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function rtlen() { + ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function rtlen01() { + ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function rtlenmb() { GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ${SRCDIR}/rtlen.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE} -- cgit v1.2.3 From bfebb6547fb331a87820be10d9c91efd274ea399 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 5 May 2013 19:03:48 +0200 Subject: All BASIC test cases are in now. --- cmake/basictest | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index e77328a8..3b8dd39a 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -19,9 +19,11 @@ export LANG=C if test -n "$COMSPEC"; then # Ignore all differences in white space. COMPARE="diff -w" + PATH_SEPARATOR="\\" else # This is a shell running in Unix environment. COMPARE="cmp" + PATH_SEPARATOR="/" fi # Each test case that cannot be handle in the "standard way" shall @@ -34,6 +36,11 @@ function regtest() { AWK=$GAWKEXE ${SRCDIR}/regtest.sh } +function compare() { + $GAWKEXE -f ${SRCDIR}/compare.awk 0 1 ${SRCDIR}/compare.in >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function inftest() { echo This test is very machine specific... $GAWKEXE -f ${SRCDIR}/inftest.awk | sed "s/inf/Inf/g" >_${TESTCASE} @@ -45,6 +52,11 @@ function getline2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function awkpath() { + AWKPATH="${SRCDIR}$(PATH_SEPARATOR)/lib" $GAWKEXE -f awkpath.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function litoct() { echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -64,6 +76,25 @@ function poundbang() { ${COMPARE} ${SRCDIR}/poundbang.awk _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` _pbd.awk } +function messages() { + $GAWKEXE -f ${SRCDIR}/messages.awk >_out2 2>_out3 + ${COMPARE} ${SRCDIR}/out1.ok _out1 && ${COMPARE} ${SRCDIR}/out2.ok _out2 && ${COMPARE} ${SRCDIR}/out3.ok _out3 && rm -f _out1 _out2 _out3 +} + +function argarray() { + case ${SRCDIR} in + .) : ;; + *) cp ${SRCDIR}/argarray.in . ;; + esac + TEST=test echo just a test | $GAWKEXE -f ${SRCDIR}/argarray.awk ./argarray.in - >_${TESTCASE} + case ${SRCDIR} in + .) : ;; + *) rm -f ./argarray.in ;; + esac + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + + function localenl() { ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} 2>/dev/null ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -96,6 +127,16 @@ function manyfiles() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function exitval1() { + $GAWKEXE -f ${SRCDIR}/exitval1.awk >_${TESTCASE} 2>&1; echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function fsspcoln() { + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk 'FS=[ :]+' ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function rsstart2() { $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/rsstart1.in >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -183,6 +224,11 @@ function fflush() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function mmap8k() { + $GAWKEXE '{ print }' ${SRCDIR}/mmap8k.in >_${TESTCASE} + ${COMPARE} ${SRCDIR}/mmap8k.in _${TESTCASE} && rm -f _${TESTCASE} || cp ${SRCDIR}/${TESTCASE}.in ${TESTCASE}.ok +} + function pid() { AWKPATH=${SRCDIR} AWK=$GAWKEXE ${SHELL} ${SRCDIR}/pid.sh $$ > _`basename ${TESTCASE}` ; : ${COMPARE} ${SRCDIR}/pid.ok _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` @@ -196,6 +242,11 @@ function strftlng() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function nors() { + echo A B C D E | tr -d '\12\15' | $GAWKEXE '{ print $NF }' - ${SRCDIR}/nors.in > _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function fmtspcl() { $GAWKEXE -v "sd=${SRCDIR}" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < ${SRCDIR}/fmtspcl.tok > ${TESTCASE}.ok 2>/dev/null $GAWKEXE $AWKFLAGS -f ${SRCDIR}/fmtspcl.awk --lint >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} @@ -211,6 +262,11 @@ function pipeio2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function arynocls() { + AWKPATH=${SRCDIR} $GAWKEXE -v INPUT=${SRCDIR}/arynocls.in -f arynocls.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function inetechu() { echo This test is for establishing UDP connections $GAWKEXE 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}' @@ -233,11 +289,52 @@ function inetdayt() { "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}' } +function redfilnm() { + $GAWKEXE -f ${SRCDIR}/redfilnm.awk srcdir=${SRCDIR} ${SRCDIR}/redfilnm.in >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function leaddig() { + $GAWKEXE -v x=2E -f ${SRCDIR}/leaddig.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function gsubtst3() { + $GAWKEXE --re-interval -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function space() { $GAWKEXE -f ' ' ${SRCDIR}/space.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function rsnulbig() { + # Suppose that block size for pipe is at most 128kB: + $GAWKEXE 'BEGIN { for (i = 1; i <= 128*64+1; i++) print "abcdefgh123456\n" }' 2>&1 | \ + $GAWKEXE 'BEGIN { RS = ""; ORS = "\n\n" }; { print }' 2>&1 | \ + $GAWKEXE '/^[^a]/; END{ print NR }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function rsnulbig2() { + $GAWKEXE 'BEGIN { ORS = ""; n = "\n"; for (i = 1; i <= 10; i++) n = (n n); \ + for (i = 1; i <= 128; i++) print n; print "abc\n" }' 2>&1 | \ + $GAWKEXE 'BEGIN { RS = ""; ORS = "\n\n" };{ print }' 2>&1 | \ + $GAWKEXE '/^[^a]/; END { print NR }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function printf0() { + $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function posix2008sub() { + $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function mpfrexprange() { $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -279,6 +376,11 @@ function rtlenmb() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function nofile() { + $GAWKEXE '{}' no/such/file >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + # Is this test case implemented as a function ? if [ "$( type -t $TESTCASE )" = "function" ] then -- cgit v1.2.3 From 263bd7ca867fdb26241a8681075f99d97c33c4d0 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Mon, 6 May 2013 17:46:17 +0200 Subject: All 377 test cases are in now. Only mbfw1 and mbprintf1 fail on Linux. --- cmake/basictest | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 167 insertions(+), 10 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 3b8dd39a..68dd8615 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -57,8 +57,13 @@ function awkpath() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function litoct() { - echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE} +function argtest() { + $GAWKEXE -f ${SRCDIR}/argtest.awk -x -y abc >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function badargs() { + $GAWKEXE -f 2>&1 | grep -v patchlevel >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } @@ -101,15 +106,20 @@ function localenl() { } function mbprintf1() { - GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE - $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } function mbfw1() { - GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE - $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function printfbad2() { + $GAWKEXE --lint -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in 2>&1 | sed "s;$SRCDIR/;;g" >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } function beginfile1() { @@ -117,6 +127,20 @@ function beginfile1() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function beginfile2() { + # This differs from the original, the pwd part is new. + # The re-direction is now bound to the .sh file. + # This way the output of "set -x" is not written to the script's output file. + ( cd ${SRCDIR} && LC_ALL=C AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh ${SRCDIR}/${TESTCASE}.in > `pwd`/_${TESTCASE} 2>&1 ) + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} +} + +function dumpvars() { + AWKPATH=${SRCDIR} $GAWKEXE --dump-variables 1 < ${SRCDIR}/${TESTCASE}.in >/dev/null 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + mv awkvars.out _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function manyfiles() { rm -rf junk mkdir junk @@ -142,6 +166,11 @@ function rsstart2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function rsstart3() { + head ${SRCDIR}/rsstart1.in | $GAWKEXE -f ${SRCDIR}/rsstart2.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function strftime() { echo This test could fail on slow machines or on a minute boundary, echo so if it does, double check the actual results: @@ -205,6 +234,46 @@ function ordchr2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function include2() { + AWKPATH=${SRCDIR} $GAWKEXE -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe2() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f inclib -f inclib.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe3() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe4() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe5() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -i hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe6() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -i inchello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe7() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i inchello >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function readfile() { $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} Makefile _${TESTCASE} && rm -f _${TESTCASE} || cp -p Makefile ${TESTCASE}.ok @@ -219,6 +288,42 @@ function fts() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok } +function charasbytes() { + [ -z "$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=${SRCDIR} $GAWKEXE -b -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in | \ + od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$//' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function symtab6() { + $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk + grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' > _${TESTCASE} ; rm __${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function symtab8() { + $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} + grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' | grep -v '^FILENAME' >> _${TESTCASE} ; rm __${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function colonwarn() { + for i in 1 2 3 ; \ + do $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk $i < ${SRCDIR}/${TESTCASE}.in ; \ + done > _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function litoct() { + echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function devfd() { + $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4<${SRCDIR}/devfd.in4 5<${SRCDIR}/devfd.in5 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function fflush() { ${SRCDIR}/fflush.sh >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -330,11 +435,40 @@ function printf0() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function profile1() { + $GAWKEXE --pretty-print=ap-${TESTCASE}.out -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out1 + $GAWKEXE -f ap-${TESTCASE}.out ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out2 ; rm ap-${TESTCASE}.out + ${COMPARE} _${TESTCASE}.out1 _${TESTCASE}.out2 && rm _${TESTCASE}.out[12] || { echo EXIT CODE: $$? >>_${TESTCASE} ; \ + cp $(srcdir)/dtdgport.awk > ${TESTCASE}.ok ; } +} + +function profile2() { + $GAWKEXE --profile=ap-${TESTCASE}.out -v sortcmd=sort -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > /dev/null + sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function profile3() { + $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null + sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function posix2008sub() { $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function next() { + LC_ALL=${GAWKLOCALE:-C} LANG=${GAWKLOCALE:-C} AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1 + LC_ALL=C ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function exit() { + AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function mpfrexprange() { $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -376,11 +510,33 @@ function rtlenmb() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function nondec2() { + $GAWKEXE --non-decimal-data -v a=0x1 -f ${SRCDIR}/${TESTCASE}.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function nofile() { $GAWKEXE '{}' no/such/file >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function binmode1() { + $GAWKEXE -v BINMODE=3 'BEGIN { print BINMODE }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function devfd1() { + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function devfd2() { + # The program text is the '1' which will print each record. How compact can you get? + $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + + # Is this test case implemented as a function ? if [ "$( type -t $TESTCASE )" = "function" ] then @@ -393,8 +549,9 @@ then ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} else $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE} + # Compare the expected (correct) output with the actual output. ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} + # If the comparison succeeds then remove the actual output. + # Else leave the actual output file untouched for later analysis. fi -# Compare the actual output with the expected (correct) output. -#${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} -- cgit v1.2.3 From 55775186a2fb7e4f61b57e2923abe4e6e4728eb0 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Mon, 6 May 2013 21:18:05 +0200 Subject: Found better way to auto-detect GETGROUPS_T and GETPGRP_VOID. --- cmake/configure.cmake | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index ec4c4e52..c8ab206a 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -44,6 +44,7 @@ include(CheckLibraryExists) include(CheckTypeSize) include(CheckStructHasMember) INCLUDE(CheckCSourceCompiles) +include(CheckPrototypeDefinition) MACRO(DefineConfigH feature) # message(STATUS feature=${feature}=${${feature}}) @@ -135,7 +136,8 @@ add_definitions(-D PRINTF_HAS_F_FORMAT) #/* Define as the return type of signal handlers (`int' or `void'). */ add_definitions(-D RETSIGTYPE=void) #add_definitions(-D PIPES_SIMULATED) -add_definitions(-D GETPGRP_VOID) +check_prototype_definition(getpgrp "pid_t getpgrp(void)" "NULL" "unistd.h" GETPGRP_VOID) +DefineConfigH(GETPGRP_VOID) #add_definitions(-D YYPARSE_PARAM) DefineFunctionIfAvailable(snprintf HAVE_SNPRINTF) @@ -205,8 +207,16 @@ DefineFunctionIfAvailable(fmod HAVE_FMOD) DefineFunctionIfAvailable(isinf HAVE_ISINF) DefineFunctionIfAvailable(ismod HAVE_ISMOD) DefineFunctionIfAvailable(getgrent HAVE_GETGRENT) -DefineFunctionIfAvailable(getgroups HAVE_GETGROUPS) -add_definitions(-D GETGROUPS_T=gid_t) +DefineSymbolIfAvailable("getgroups" "unistd.h" HAVE_GETGROUPS) +if (${HAVE_GETGROUPS}) + check_prototype_definition(getgroups "int getgroups(int size, gid_t list[])" "NULL" "unistd.h" GETGROUPS_T) + if (${GETGROUPS_T}) + DefineConfigHValue(GETGROUPS_T gid_t) + else() + DefineConfigHValue(GETGROUPS_T int) + endif() +endif() + DefineTypeIfAvailable("pid_t" PID_T) DefineTypeIfAvailable("intmax_t" HAVE_INTMAX_T) DefineFunctionIfAvailable(grantpt HAVE_GRANTPT) -- cgit v1.2.3 From 56e0891a41a9b151c9dfe7665401ba5950ac2f91 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 7 May 2013 17:49:46 +0200 Subject: All 377 test cases pass now. mbfw1 and mbprintf1 need LANG=en_US.UTF-8. Handling of LOCALES has to be aligned with master branch. --- cmake/basictest | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 68dd8615..990c7785 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -107,12 +107,14 @@ function localenl() { function mbprintf1() { GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + LANG=en_US.UTF-8 $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } function mbfw1() { GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + LANG=en_US.UTF-8 $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -- cgit v1.2.3 From f002cb87a7ec02f311c75ad5c0d9e31cf7519aa1 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Thu, 9 May 2013 18:48:29 +0200 Subject: New function simple_test_case simplifies test case execution. --- cmake/basictest | 124 ++++++++++++++++++++++++-------------------------------- 1 file changed, 52 insertions(+), 72 deletions(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index 990c7785..d2829d31 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -9,7 +9,6 @@ set -x export PATH=$PATH:/c/MinGW/msys/1.0/bin export GAWKEXE=$1 export TESTCASE=$2 -export OPTION=$3 TOPSRCDIR=$(dirname ${0})/.. SRCDIR=${TOPSRCDIR}/test export AWKPATH=${SRCDIR} @@ -26,9 +25,43 @@ else PATH_SEPARATOR="/" fi +# This is the central function for executing a standard test case. +# Many of the more specialized test cases rely on this function. +function simple_test_case() { + local options=$1 # options passed to the gawk executable + local parameters=$2 # parameters passed to the test case script + cd ${SRCDIR} + if test -r ${TESTCASE}.in + # Any existing .in file will be redirected to standard input. + # The output redirection must be bound to the test script, otherwise + # the "set -x" logging would mix with the test case output. + then + ${pregawk} $GAWKEXE ${options} -f ${TESTCASE}.awk ${parameters} < ${TESTCASE}.in ${postgawk} > _${TESTCASE} 2>&1 + else + ${pregawk} $GAWKEXE ${options} -f ${TESTCASE}.awk ${parameters} ${postgawk} > _${TESTCASE} 2>&1 + fi || echo EXIT CODE: $? >> _${TESTCASE} + # Compare the expected (correct) output with the actual output. + ${COMPARE} ${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + # If the comparison succeeds then remove the actual output. + # Else leave the actual output file untouched for later analysis. +} + # Each test case that cannot be handle in the "standard way" shall # be implemented as a function here. +function lintold() { simple_test_case "--lint-old" "" ; } +function defref() { simple_test_case "--lint" "" ; } +function fmtspcl() { simple_test_case "--lint" "" ; } +function lintwarn() { simple_test_case "--lint" "" ; } +function noeffect() { simple_test_case "--lint" "" ; } +function nofmtch() { simple_test_case "--lint" "" ; } +function shadow() { simple_test_case "--lint" "" ; } +function uninit2() { simple_test_case "--lint" "" ; } +function uninit3() { simple_test_case "--lint" "" ; } +function uninit4() { simple_test_case "--lint" "" ; } +function uninit5() { simple_test_case "--lint" "" ; } +function uninitialized() { simple_test_case "--lint" "" ; } + function regtest() { echo 'Some of the output from regtest is very system specific, do not' echo 'be distressed if your output differs from that distributed.' @@ -36,10 +69,7 @@ function regtest() { AWK=$GAWKEXE ${SRCDIR}/regtest.sh } -function compare() { - $GAWKEXE -f ${SRCDIR}/compare.awk 0 1 ${SRCDIR}/compare.in >_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function compare() { simple_test_case "" "0 1" ; } function inftest() { echo This test is very machine specific... @@ -47,30 +77,21 @@ function inftest() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function getline2() { - $GAWKEXE -f ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk >_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function getline2() { simple_test_case "" "getline2.awk getline2.awk" ; } function awkpath() { AWKPATH="${SRCDIR}$(PATH_SEPARATOR)/lib" $GAWKEXE -f awkpath.awk >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function argtest() { - $GAWKEXE -f ${SRCDIR}/argtest.awk -x -y abc >_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function argtest() { simple_test_case "" "-x -y abc" ; } function badargs() { $GAWKEXE -f 2>&1 | grep -v patchlevel >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function nonl() { - AWKPATH=${SRCDIR} $GAWKEXE --lint -f nonl.awk /dev/null >_${TESTCASE} 2>&1 - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function nonl() { simple_test_case "--lint" "/dev/null" ; } function poundbang() { # The original poundbang test case looks a bit non-deterministic. @@ -286,8 +307,7 @@ function fts() { echo This test may fail on IRIX systems when run on an NFS filesystem.; \ echo If it does, try rerunning on an xfs filesystem. ; \ fi - ( cd ${SRCDIR} ; $GAWKEXE -f ${TESTCASE}.awk ) - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok + simple_test_case "" "" } function charasbytes() { @@ -337,8 +357,8 @@ function mmap8k() { } function pid() { - AWKPATH=${SRCDIR} AWK=$GAWKEXE ${SHELL} ${SRCDIR}/pid.sh $$ > _`basename ${TESTCASE}` ; : - ${COMPARE} ${SRCDIR}/pid.ok _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` + AWKPATH=${SRCDIR} AWK=$GAWKEXE ${SHELL} ${SRCDIR}/pid.sh $$ > _${TESTCASE} ; : + ${COMPARE} ${SRCDIR}/pid.ok _`basename ${TESTCASE}` && rm -f _${TESTCASE} } function strftlng() { @@ -364,10 +384,7 @@ function fmtspcl() { fi } -function pipeio2() { - $GAWKEXE -v SRCDIR=${SRCDIR} -f ${SRCDIR}/pipeio2.awk >_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function pipeio2() { simple_test_case "-v SRCDIR=${SRCDIR}" "" ; } function arynocls() { AWKPATH=${SRCDIR} $GAWKEXE -v INPUT=${SRCDIR}/arynocls.in -f arynocls.awk >_${TESTCASE} @@ -396,15 +413,9 @@ function inetdayt() { "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}' } -function redfilnm() { - $GAWKEXE -f ${SRCDIR}/redfilnm.awk srcdir=${SRCDIR} ${SRCDIR}/redfilnm.in >_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function redfilnm() { simple_test_case "" "srcdir=${SRCDIR}" ; } -function leaddig() { - $GAWKEXE -v x=2E -f ${SRCDIR}/leaddig.awk >_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function leaddig() { simple_test_case "-v x=2E" "" ; } function gsubtst3() { $GAWKEXE --re-interval -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} @@ -432,10 +443,7 @@ function rsnulbig2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function printf0() { - $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function printf0() { simple_test_case "--posix" "" ; } function profile1() { $GAWKEXE --pretty-print=ap-${TESTCASE}.out -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out1 @@ -471,25 +479,10 @@ function exit() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function mpfrexprange() { - $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} - -function mpfrrnd() { - $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} - -function mpfrnr() { - $GAWKEXE -M -vPREC=113 -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in > _${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} - -function mpfrbigint() { - $GAWKEXE -M -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function mpfrexprange() { simple_test_case "-M -vPREC=53 " "" ; } +function mpfrrnd() { simple_test_case "-M -vPREC=53 " "" ; } +function mpfrnr() { simple_test_case "-M -vPREC=113" "" ; } +function mpfrbigint() { simple_test_case "-M " "" ; } function jarebug() { ${SRCDIR}/${TESTCASE}.sh "$GAWKEXE" "${SRCDIR}/${TESTCASE}.awk" "${SRCDIR}/${TESTCASE}.in" "_${TESTCASE}" @@ -512,10 +505,7 @@ function rtlenmb() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function nondec2() { - $GAWKEXE --non-decimal-data -v a=0x1 -f ${SRCDIR}/${TESTCASE}.awk >_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -} +function nondec2() { simple_test_case "--non-decimal-data -v a=0x1" "" ; } function nofile() { $GAWKEXE '{}' no/such/file >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} @@ -538,22 +528,12 @@ function devfd2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } - # Is this test case implemented as a function ? if [ "$( type -t $TESTCASE )" = "function" ] then $TESTCASE -# If no function exists, then treat the test case in standard way. -elif test -r ${SRCDIR}/${TESTCASE}.in -# Any existing .in file will be redirected to standard input. -then - $GAWKEXE ${OPTION} -f ${TESTCASE}.awk < ${SRCDIR}/${TESTCASE}.in > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} else - $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE} - # Compare the expected (correct) output with the actual output. - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} - # If the comparison succeeds then remove the actual output. - # Else leave the actual output file untouched for later analysis. + # If no function exists, then treat the test case in standard way. + simple_test_case "" "" fi -- cgit v1.2.3 From 61f18b3aac9acf83f06163e37461eea5d915523b Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 11 May 2013 10:48:41 +0200 Subject: Generated file CTestCustom.cmake contains test cases that shall be skipped. --- cmake/README.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt index 60dde159..451f2a6c 100644 --- a/cmake/README.txt +++ b/cmake/README.txt @@ -79,3 +79,17 @@ and several other files). Proceed as describe above for cross-compilers. The command "make ; make package" will build gawk.exe and the installer file +- How can I run test cases ? +You can run all the test cases that are defined in test/Makefile.am. +These test case scripts were not changed, but the way they are invoked has +been adapted to CMake habits. +See http://cmake.org/Wiki/CMake/Testing_With_CTest#Simple_Testing + cmake .. + make + make test # run all test cases + ctest -N # list all test cases but don't run them + ctest -R BASIC # run all test case belonging to group BASIC + ctest -R MPFR # run all test case belonging to group MPFR + ctest -E SHLIB.filefunc # run all tests, except the SHLIB.filefunc test case +Remember that running test cases is possible only after a native build. + -- cgit v1.2.3 From 3582c0812a82986ddd6959c28db520dc376e39e0 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 11 May 2013 12:27:47 +0200 Subject: Test case SHLIB.filefuncs needs the gawk exe in source directory. --- cmake/README.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt index 451f2a6c..b291d1be 100644 --- a/cmake/README.txt +++ b/cmake/README.txt @@ -88,8 +88,8 @@ See http://cmake.org/Wiki/CMake/Testing_With_CTest#Simple_Testing make make test # run all test cases ctest -N # list all test cases but don't run them - ctest -R BASIC # run all test case belonging to group BASIC - ctest -R MPFR # run all test case belonging to group MPFR + ctest -R BASIC # run all test cases belonging to group BASIC + ctest -R MPFR # run all test cases belonging to group MPFR ctest -E SHLIB.filefunc # run all tests, except the SHLIB.filefunc test case Remember that running test cases is possible only after a native build. -- cgit v1.2.3 From df80d9b911fcfff4c9e2da2d6a820f074108f696 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 11 May 2013 14:32:04 +0200 Subject: Test cases longwrds and charasbytes pass now on MinGW. --- cmake/basictest | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index d2829d31..beecb6ae 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -312,7 +312,7 @@ function fts() { function charasbytes() { [ -z "$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ - AWKPATH=${SRCDIR} $GAWKEXE -b -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in | \ + AWKPATH=${SRCDIR} $GAWKEXE -b -v BINMODE=2 -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in | \ od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$//' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } @@ -416,6 +416,7 @@ function inetdayt() { function redfilnm() { simple_test_case "" "srcdir=${SRCDIR}" ; } function leaddig() { simple_test_case "-v x=2E" "" ; } +function longwrds() { simple_test_case "-vSORT=sort" "" ; } function gsubtst3() { $GAWKEXE --re-interval -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} -- cgit v1.2.3 From 57fe811dd036e276abd30eed3aac135df7e362ab Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 12 May 2013 15:31:28 +0200 Subject: HAVE_LIBREADLINE is now detected and used. --- cmake/configure.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index c8ab206a..6ff19995 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -284,6 +284,7 @@ include(GetPrerequisites) DefineLibraryIfAvailable(m sin "" HAVE_LIBM) DefineLibraryIfAvailable(mpfr mpfr_add_si "" HAVE_MPFR) DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS) +DefineLibraryIfAvailable(readline readline "" HAVE_LIBREADLINE) DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH) DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H) DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H) -- cgit v1.2.3 From 9c32ff7ed5aeca6906dbdb5bcf602f675893f3be Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 18 May 2013 18:35:13 +0200 Subject: Doc files are now built with clean dependencies. --- cmake/docmaker | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 cmake/docmaker (limited to 'cmake') diff --git a/cmake/docmaker b/cmake/docmaker new file mode 100755 index 00000000..f9a821e9 --- /dev/null +++ b/cmake/docmaker @@ -0,0 +1,61 @@ +#!/bin/sh + +# TODO +# Check all dependencies first, then build the target. +# Each target shall be implemented as one function. + +if test $# -lt 1; then + echo " $0: Incorrect number ($#) of parameters passed: $*" +fi +OUTFILE=$1 +if test $OUTFILE = gawk.texi; then + INFILE=gawktexi.in + COMMAND="awk -f sidebar.awk < gawktexi.in > gawk.texi" +elif test $OUTFILE = gawk.dvi; then + INFILE=gawk.texi + COMMAND="texi2dvi -q --clean gawk.texi" +elif test $OUTFILE = gawkinet.dvi; then + INFILE=gawkinet.texi + COMMAND="texi2dvi -q --clean gawkinet.texi" +elif test $OUTFILE = gawk.1.ps; then + INFILE=gawk.1 + COMMAND="groff -z -man gawk.1 > gawk.1.ps" +elif test $OUTFILE = igawk.1.ps; then + INFILE=igawk.1 + COMMAND="groff -z -man igawk.1 > igawk.1.ps" +elif test $OUTFILE = gawk.1.pdf; then + INFILE=gawk.1.ps + COMMAND="ps2pdf -q gawk.1.ps gawk.1.pdf" +elif test $OUTFILE = igawk.1.pdf; then + INFILE=igawk.1.ps + COMMAND="ps2pdf -q igawk.1.ps igawk.1.pdf" +elif test $OUTFILE = gawk.ps; then + INFILE=gawk.dvi + COMMAND="dvips -q -o gawk.ps gawk.dvi" +elif test $OUTFILE = gawkinet.ps; then + INFILE=gawkinet.dvi + COMMAND="dvips -q -o gawkinet.ps gawkinet.dvi" +elif test $OUTFILE = gawk.pdf; then + INFILE=gawk.ps + COMMAND="ps2pdf -q gawk.ps gawk.pdf" +elif test $OUTFILE = gawkinet.pdf; then + INFILE=gawkinet.ps + COMMAND="ps2pdf -q gawkinet.ps gawkinet.pdf" +else + echo " unknwon target $OUTFILE" + exit 1 +fi + +if ! test -r "$INFILE"; then + echo " $0: Cannot read input file $INFILE" + exit 1 +fi + +if test -f "$OUTFILE"; then + if test "$INFILE" -ot "$OUTFILE" ; then + printf " Target %15s is up-to-date\n" $OUTFILE + exit 0 + fi +fi +echo " Generating $OUTFILE from $INFILE" +echo $COMMAND | sh -- cgit v1.2.3 From 2cd2431737dd088c4eb957e27aa6a1edb17aa88e Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 19 May 2013 11:45:18 +0200 Subject: Added more doc dependencies; some of them incomplete. --- cmake/docmaker | 145 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 53 deletions(-) (limited to 'cmake') diff --git a/cmake/docmaker b/cmake/docmaker index f9a821e9..873d9463 100755 --- a/cmake/docmaker +++ b/cmake/docmaker @@ -1,61 +1,100 @@ #!/bin/sh -# TODO -# Check all dependencies first, then build the target. -# Each target shall be implemented as one function. - -if test $# -lt 1; then +# The first parameter is the target, the file to be built. +# All remaining parameters are dependencies (file names). +if [ $# -lt 1 ] ; then echo " $0: Incorrect number ($#) of parameters passed: $*" fi OUTFILE=$1 -if test $OUTFILE = gawk.texi; then - INFILE=gawktexi.in - COMMAND="awk -f sidebar.awk < gawktexi.in > gawk.texi" -elif test $OUTFILE = gawk.dvi; then - INFILE=gawk.texi - COMMAND="texi2dvi -q --clean gawk.texi" -elif test $OUTFILE = gawkinet.dvi; then - INFILE=gawkinet.texi - COMMAND="texi2dvi -q --clean gawkinet.texi" -elif test $OUTFILE = gawk.1.ps; then - INFILE=gawk.1 - COMMAND="groff -z -man gawk.1 > gawk.1.ps" -elif test $OUTFILE = igawk.1.ps; then - INFILE=igawk.1 - COMMAND="groff -z -man igawk.1 > igawk.1.ps" -elif test $OUTFILE = gawk.1.pdf; then - INFILE=gawk.1.ps - COMMAND="ps2pdf -q gawk.1.ps gawk.1.pdf" -elif test $OUTFILE = igawk.1.pdf; then - INFILE=igawk.1.ps - COMMAND="ps2pdf -q igawk.1.ps igawk.1.pdf" -elif test $OUTFILE = gawk.ps; then - INFILE=gawk.dvi - COMMAND="dvips -q -o gawk.ps gawk.dvi" -elif test $OUTFILE = gawkinet.ps; then - INFILE=gawkinet.dvi - COMMAND="dvips -q -o gawkinet.ps gawkinet.dvi" -elif test $OUTFILE = gawk.pdf; then - INFILE=gawk.ps - COMMAND="ps2pdf -q gawk.ps gawk.pdf" -elif test $OUTFILE = gawkinet.pdf; then - INFILE=gawkinet.ps - COMMAND="ps2pdf -q gawkinet.ps gawkinet.pdf" -else - echo " unknwon target $OUTFILE" - exit 1 -fi +shift 1 +INFILES="$@" -if ! test -r "$INFILE"; then - echo " $0: Cannot read input file $INFILE" - exit 1 -fi +MAKEINFO="makeinfo --no-split --force" +TROFF="groff -t -Tps -U" +SEDME="sed -e \"s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/\" -e \"s/^\/level0 save def/\/level0 save def 30 -48 translate/\"" +SEDME2="sed '/%%Page: 10 10/,/0 Cg EP/d'" + +function BuildTarget() +{ + local OUTFILE=$1 + local INFILE="" + local COMMAND="" + + FILEBASE=${OUTFILE%.*} + case $OUTFILE in + *\.in | *\.1 | macros | cardfonts | colors | ad.block | setter.outline | \ + gawkinet.texi | rflashlight.eps | api-figure1.fig | api-figure2.fig | api-figure3.fig | \ + general-program.fig | process-flow.fig | statist.eps) + INFILE=$OUTFILE + ;; + *\.texi) + if [ $FILEBASE = gawk ] ; then + INFILE=gawktexi.in + else + INFILE=$OUTFILE.in + fi + COMMAND="awk -f sidebar.awk < $INFILE > $OUTFILE" + ;; + *\.dvi) + INFILE=$FILEBASE.texi + COMMAND="texi2dvi -q --clean $INFILE" + ;; + *\.info) + INFILE=$FILEBASE.texi + COMMAND="${MAKEINFO} $INFILE" + ;; + *\.ps) + if [ $FILEBASE = awkcard ] ; then + INFILE=awkcard.in + COMMAND="${TROFF} $* | ${SEDME} | cat setter.outline - | ${SEDME2} > awkcard.ps" + elif [ $FILEBASE = gawk.1 -o $FILEBASE = igawk.1 ] ; then + INFILE=$FILEBASE + COMMAND="groff -z -man $INFILE > $OUTFILE" + else + INFILE=$FILEBASE.dvi + COMMAND="dvips -q -o $OUTFILE $INFILE" + fi + ;; + *\.pdf) + INFILE=$FILEBASE.ps + COMMAND="ps2pdf -q $INFILE $OUTFILE" + ;; + *\.tr) + INFILE=$FILEBASE.in + COMMAND="sed 's:SRCDIR:.:' < $INFILE > $OUTFILE" + ;; + *\.nc) + INFILE=$FILEBASE.in + COMMAND="sed 's:SRCDIR:.:' < $INFILE > $OUTFILE" + COMMAND="${TROFF} $* | ${SEDME} | cat setter.outline - | ${SEDME2} > $FILEBASE.ps && touch $OUTFILE" + ;; + *) + echo " unknwon target $OUTFILE" + exit 1 + esac -if test -f "$OUTFILE"; then - if test "$INFILE" -ot "$OUTFILE" ; then - printf " Target %15s is up-to-date\n" $OUTFILE - exit 0 + if [ ! -r "$INFILE" ] ; then + echo " $0: Cannot read input file $INFILE" + exit 1 fi -fi -echo " Generating $OUTFILE from $INFILE" -echo $COMMAND | sh + + if [ -f "$OUTFILE" ] ; then + if [ "$INFILE" -ot "$OUTFILE" ] ; then + #printf " Target %15s is up-to-date\n" $OUTFILE + exit 0 + fi + fi + #echo " Generating $OUTFILE from $INFILE" + echo $COMMAND | sh -x + #echo "COMMAND=$COMMAND" +} + +# Build all dependencies first, then build the target. +for dep in $INFILES +do + #echo $OUTFILE depends on $dep + BuildTarget $dep + : +done +BuildTarget $OUTFILE + -- cgit v1.2.3 From 540418bc7d1f84f7f1cdabbc9ccb093447f1c320 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 19 May 2013 12:36:51 +0200 Subject: configure script stub as suggested by Arnold. --- cmake/configure | 19 +++++++++++++++++++ cmake/docmaker | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 cmake/configure (limited to 'cmake') diff --git a/cmake/configure b/cmake/configure new file mode 100644 index 00000000..f79d4c45 --- /dev/null +++ b/cmake/configure @@ -0,0 +1,19 @@ +# On 2013-05-14 Arnold wrote in an e-mail: + +# Date: Sun, 19 May 2013 15:55:07 +0200 Subject: First outline of the configure script invokes cmake. --- cmake/configure | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) mode change 100644 => 100755 cmake/configure (limited to 'cmake') diff --git a/cmake/configure b/cmake/configure old mode 100644 new mode 100755 index f79d4c45..922568de --- a/cmake/configure +++ b/cmake/configure @@ -1,3 +1,4 @@ +#!/bin/sh # On 2013-05-14 Arnold wrote in an e-mail: # Toolchain.cmake + +# TODO: Allow the build directory to be in other places. +# A parameter is needed to pass the value. +cmake -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake .. + -- cgit v1.2.3 From 2dbda7d9bb23f050673841c42f845be539e19a2c Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 19 May 2013 17:15:26 +0200 Subject: configure parameters CC and --prefix work now. --- cmake/configure | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/configure b/cmake/configure index 922568de..356bdfca 100755 --- a/cmake/configure +++ b/cmake/configure @@ -34,6 +34,15 @@ fi # TODO: Evaluate all the options and translate the options into CMake variables. CC=$( which cc ) +PREFIX="" + +for p in $@ +do + if [ ${p:0:3} = "CC=" ]; then CC=${p:3}; fi + if [ ${p:0:9} = "--prefix=" ]; then PREFIX=-DCMAKE_INSTALL_PREFIX=${p:9}; fi +done +CC=$( which $CC ) + rm -f Toolchain.cmake ( echo "set(CMAKE_C_COMPILER $CC)" @@ -44,5 +53,5 @@ rm -f Toolchain.cmake # TODO: Allow the build directory to be in other places. # A parameter is needed to pass the value. -cmake -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake .. +cmake ${PREFIX} -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake .. -- cgit v1.2.3 From 6013197b678697404fe44e8db58a9d40a2832ce4 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sun, 19 May 2013 18:29:01 +0200 Subject: configure parameters --srcdir and --with-whiny-user-strftime work now. --- cmake/configure | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'cmake') diff --git a/cmake/configure b/cmake/configure index 356bdfca..d375a81c 100755 --- a/cmake/configure +++ b/cmake/configure @@ -26,20 +26,18 @@ if [ -f CMakeLists.txt ] ; then exit 1 fi -if ! [ -f ../CMakeLists.txt ] ; then - echo "The directory above your current working directory does not contain a file CMakeLists.txt." - echo "This script will run only if you are one level below the source directory." - exit 1 -fi - # TODO: Evaluate all the options and translate the options into CMake variables. CC=$( which cc ) PREFIX="" +SRCDIR=".." +WHINY="" for p in $@ do if [ ${p:0:3} = "CC=" ]; then CC=${p:3}; fi if [ ${p:0:9} = "--prefix=" ]; then PREFIX=-DCMAKE_INSTALL_PREFIX=${p:9}; fi + if [ ${p:0:9} = "--srcdir=" ]; then SRCDIR=${p:9}; fi + if [ ${p:0:26} = "--with-whiny-user-strftime" ]; then WHINY=-DUSE_INCLUDED_STRFTIME=1; fi done CC=$( which $CC ) @@ -51,7 +49,10 @@ rm -f Toolchain.cmake echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" ) > Toolchain.cmake -# TODO: Allow the build directory to be in other places. -# A parameter is needed to pass the value. -cmake ${PREFIX} -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake .. +if ! [ -f ${SRCDIR}/CMakeLists.txt ] ; then + echo "The source directory (${SRCDIR}) does not contain a file CMakeLists.txt." + exit 1 +fi + +cmake ${PREFIX} ${WHINY} -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake ${SRCDIR} -- cgit v1.2.3 From 0ac63db595a009d1f07dba8246e52710348b0798 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Sat, 1 Jun 2013 18:28:35 +0200 Subject: New test cases profile4 and profile5 from master branch. --- cmake/basictest | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cmake') diff --git a/cmake/basictest b/cmake/basictest index beecb6ae..210ed224 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -297,6 +297,7 @@ function incdupe7() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +# TODO: The compare operation passes even when there are diffs. function readfile() { $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} Makefile _${TESTCASE} && rm -f _${TESTCASE} || cp -p Makefile ${TESTCASE}.ok @@ -465,6 +466,18 @@ function profile3() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function profile4() { + GAWK_NO_PP_RUN=1 $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null + sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function profile5() { + GAWK_NO_PP_RUN=1 $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null + sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function posix2008sub() { $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} -- cgit v1.2.3 From 88cdccf6bceb2078895fec825f0b776487197c78 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 24 Jun 2014 14:38:18 +0200 Subject: Definition of _GL_ATTRIBUTE_PURE is needed by dfa.h for some strange reason. --- cmake/configure.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 6ff19995..204b2793 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -107,10 +107,11 @@ STRING( REGEX REPLACE ".*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" GAWK_BUGFIX_VERSION # The definition of the symbol GAWK cannot be passed in config.h # because the extensions will fail to build. add_definitions(-DGAWK) +DefineConfigHValue(_GL_ATTRIBUTE_PURE "__attribute__ ((__pure__))") DefineConfigHValue(GAWK_VERSION "${GAWK_MAJOR_VERSION}.${GAWK_MINOR_VERSION}.${GAWK_BUGFIX_VERSION}") DefineConfigHValue(VERSION \\"${GAWK_VERSION}\\") DefineConfigHValue(PACKAGE \\"gawk\\") -DefineConfigHValue(PACKAGE_STRING "GNU Awk ${GAWK_VERSION}") +DefineConfigHValue(PACKAGE_STRING \\"GNU Awk ${GAWK_VERSION}\\") DefineConfigHValue(PACKAGE_TARNAME \\"gawk\\") DefineConfigHValue(PACKAGE_URL \\"http://www.gnu.org/software/gawk/\\") DefineConfigHValue(PACKAGE_VERSION \\"${GAWK_VERSION}\\") -- cgit v1.2.3 From 01f1baef24748e4741572fbd7ed8a1dce522fe95 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Fri, 8 Aug 2014 21:15:48 +0200 Subject: Moved the file so that it becomes a bit more visible to the public when the cmake branch gets merged into the master branch. --- cmake/README.txt | 95 -------------------------------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 cmake/README.txt (limited to 'cmake') diff --git a/cmake/README.txt b/cmake/README.txt deleted file mode 100644 index b291d1be..00000000 --- a/cmake/README.txt +++ /dev/null @@ -1,95 +0,0 @@ -CMake is a build automation system - http://en.wikipedia.org/wiki/Cmake - -We try to use it as a replacement for the established GNU build system. -This attempt is currently only experimental. If you wonder why anyone -should do this, read - - Why the KDE project switched to CMake -- and how - http://lwn.net/Articles/188693/ - Escape from GNU Autohell! - http://www.shlomifish.org/open-source/anti/autohell - -- How can I get GNU Awk compiled with CMake as fast as possible ? - git clone git://git.savannah.gnu.org/gawk.git - cd gawk - git checkout cmake - mkdir build - cd build - cmake .. - make - ./gawk --version - make test -Notice that this git-checkout allows you to read the source code, -track the cmake branch and get updates. You will not be able to -commit anything. - -- How can I use git to contribute source code ? -You need an account at Savannah. Read this to understand the first steps: - http://savannah.gnu.org/maintenance/UsingGit - README.git -Use your account there to register your public ssh key at Savannah. -Then you are ready to checkout. Remember that (when cloning) you are -setting up your own local repository and make sure you configure it -properly. - git clone ssh://my_account_name@git.sv.gnu.org/srv/git/gawk.git - git config --global user.name "first-name last-name" - git config --global user.email First.Last@email.com - git config --global color.ui auto - -- What is the current status of the cmake branch ? -It has just begun, pre-alpha, unclear if it will ever be taken up -by the maintainer. We want to study if using CMake with such a -basic tool like gawk is feasible and if it easier to use than -the GNU build system. - -- Where can I find a tutorial on CMake basics ? -Use the "official tutorial": - http://www.cmake.org/cmake/help/cmake_tutorial.html - -- Where is the reference of all commands and variables ? -Depending on the CMake version you use, select one of these: - http://www.cmake.org/cmake/help/v2.8.10/cmake.html - -- How can I cross-compile ? -Proceed in the same way as explained above for native compilation, -but use a different build directory. When using CMake, do this: - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain_mingw32.cmake .. -Write a new Toolchain file for your cross-compiler and use it. - -- How can I build an installable file ? -Use "make package". The exact kind of installable file depends on your -operating system and defaults to TGZ. - -- Can I build an executable that runs on any Win32 platform ? -Yes, there are two ways of doing this. -In both cases you need a MinGW compiler and the NSIS package builder -installed on the host that shall do the build. - http://sourceforge.net/projects/mingw - http://sourceforge.net/projects/nsis -When installed properly, the NSIS tool can even build an installer file -(a single .exe file that unpacks, registers and installs the gawk executable -and several other files). -1. way: native build on a Win32 platform - http://www.cmake.org/cmake/help/runningcmake.html - After clicking "Configure" select the MinGW option with the default native compiler - In the build directory, the command "mingw32-make" will build the gawk.exe - The command "mingw32-make package" will build installer file -2. way: build with cross-compiler on a Linux platform like Ubuntu 12.04 LTS - Proceed as describe above for cross-compilers. - The command "make ; make package" will build gawk.exe and the installer file - -- How can I run test cases ? -You can run all the test cases that are defined in test/Makefile.am. -These test case scripts were not changed, but the way they are invoked has -been adapted to CMake habits. -See http://cmake.org/Wiki/CMake/Testing_With_CTest#Simple_Testing - cmake .. - make - make test # run all test cases - ctest -N # list all test cases but don't run them - ctest -R BASIC # run all test cases belonging to group BASIC - ctest -R MPFR # run all test cases belonging to group MPFR - ctest -E SHLIB.filefunc # run all tests, except the SHLIB.filefunc test case -Remember that running test cases is possible only after a native build. - -- cgit v1.2.3 From 1f4bd1601d0abb51db4cf28d0a3b51d8661bda94 Mon Sep 17 00:00:00 2001 From: Juergen Kahrs Date: Tue, 12 Aug 2014 17:10:28 +0200 Subject: Copyright notice updated. --- cmake/configure.cmake | 2 +- cmake/package.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 204b2793..7dbe841c 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -1,7 +1,7 @@ # # cmake/configure --- CMake input file for gawk # -# Copyright (C) 2013 +# Copyright (C) 2013-2014 # the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the diff --git a/cmake/package.cmake b/cmake/package.cmake index b63c2863..203a8c3b 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -1,7 +1,7 @@ # # cmake/package --- CMake input file for gawk # -# Copyright (C) 2013 +# Copyright (C) 2013-2014 # the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the -- cgit v1.2.3