From aafe43a7153f52b6375e7948be88354dc53702e4 Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Sat, 19 Aug 2023 08:28:39 +0200 Subject: [PATCH] os400: build test servers Also fix a non-compliant main prototype in disabled.c. Closes #11547 --- packages/OS400/initscript.sh | 7 +- packages/OS400/make-tests.sh | 178 ++++++++++++++++++++--------------- tests/server/disabled.c | 6 +- 3 files changed, 111 insertions(+), 80 deletions(-) diff --git a/packages/OS400/initscript.sh b/packages/OS400/initscript.sh index c092e1c2d5..935797c411 100755 --- a/packages/OS400/initscript.sh +++ b/packages/OS400/initscript.sh @@ -185,8 +185,9 @@ make_module() echo "#line 1" >> __tmpsrcf.c cat "${2}" >> __tmpsrcf.c CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')" -# CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)" - CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)" + CMD="${CMD} SYSIFCOPT(*IFS64IO *ASYNCSIGNAL)" +# CMD="${CMD} OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)" + CMD="${CMD} OPTION(*INCDIRFIRST)" CMD="${CMD} LOCALETYPE(*LOCALE) FLAG(10)" CMD="${CMD} INCDIR('${QADRTDIR}/include'" CMD="${CMD} '${TOPDIR}/include/curl' '${TOPDIR}/include' '${SRCDIR}'" @@ -265,6 +266,7 @@ versioned_copy() # The `sed' statement works as follows: # - Join \nl-separated lines. # - Retain only lines that begins with "identifier =". +# - Replace @...@ sustitutions by shell variable references. # - Turn these lines into shell variable assignments. get_make_vars() @@ -277,6 +279,7 @@ get_make_vars() -e 'b begin' \ -e '}' \ -e '/^[A-Za-z_][A-Za-z0-9_]*[[:space:]]*=/!d' \ + -e 's/@\\([A-Za-z0-9_]*\\)@/${\\1}/g' \ -e 's/[[:space:]]*=[[:space:]]*/=/' \ -e 's/=\\(.*[^[:space:]]\\)[[:space:]]*$/=\\"\\1\\"/' \ -e 's/\\\$(\\([^)]*\\))/\${\\1}/g' \ diff --git a/packages/OS400/make-tests.sh b/packages/OS400/make-tests.sh index 470fb51012..ed475956c9 100755 --- a/packages/OS400/make-tests.sh +++ b/packages/OS400/make-tests.sh @@ -32,90 +32,114 @@ SCRIPTDIR=`dirname "${0}"` cd "${TOPDIR}/tests" -# tests directory not implemented yet. +# Build programs in a directory. +build_all_programs() -# Process the libtest subdirectory. +{ + # Compile all programs. + # The list is found in variable "noinst_PROGRAMS" -cd libtest + INCLUDES="'`pwd`' '${TOPDIR}/lib' '${TOPDIR}/src'" + MODS="${1}" + SRVPGMS="${2}" -# Get definitions from the Makefile.inc file. + for PGM in ${noinst_PROGRAMS} + do DB2PGM=`db2_name "${PGM}"` + PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM" -get_make_vars Makefile.inc + # Extract preprocessor symbol definitions from + # compilation options for the program. -# Special case: redefine chkhostname compilation parameters. + PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`" + PGMDFNS= -chkhostname_SOURCES=chkhostname.c -chkhostname_LDADD=curl_gethostname.o - -# Compile all programs. -# The list is found in variable "noinst_PROGRAMS" - -INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'" - -for PGM in ${noinst_PROGRAMS} -do DB2PGM=`db2_name "${PGM}"` - PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM" - - # Extract preprocessor symbol definitions from compilation - # options for the program. - - PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`" - PGMDEFINES= - - for FLAG in ${PGMCFLAGS} - do case "${FLAG}" in - -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`" - PGMDEFINES="${PGMDEFINES} '${DEFINE}'" - ;; - esac - done - - # Compile all C sources for the program into modules. - - PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`" - LINK= - MODULES= - - for SOURCE in ${PGMSOURCES} - do case "${SOURCE}" in - *.c) # Special processing for libxxx.c files: their - # module name is determined by the target - # PROGRAM name. - - case "${SOURCE}" in - lib*.c) MODULE="${DB2PGM}" - ;; - *) MODULE=`db2_name "${SOURCE}"` - ;; - esac - - make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}" - if action_needed "${PGMIFSNAME}" "${MODIFSNAME}" - then LINK=yes - fi - ;; - esac - done - - # Link program if needed. - - if [ "${LINK}" ] - then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`" - for LDARG in ${PGMLDADD} - do case "${LDARG}" in - -*) ;; # Ignore non-module. - *) MODULES="${MODULES} "`db2_name "${LDARG}"` + for FLAG in ${PGMCFLAGS} + do case "${FLAG}" in + -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`" + PGMDFNS="${PGMDFNS} '${DEFINE}'" ;; esac done - MODULES="`echo \"${MODULES}\" | - sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`" - CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})" - CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)" - CMD="${CMD} MODULE(${MODULES})" - CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)" - CMD="${CMD} TGTRLS(${TGTRLS})" - CLcommand "${CMD}" - fi -done + + # Compile all C sources for the program into modules. + + PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`" + LINK= + MODULES= + + for SOURCE in ${PGMSOURCES} + do case "${SOURCE}" in + *.c) # Special processing for libxxx.c files: + # their module name is determined + # by the target PROGRAM name. + + case "${SOURCE}" in + lib*.c) MODULE="${DB2PGM}" + ;; + *) MODULE=`db2_name "${SOURCE}"` + ;; + esac + + # If source is in a sibling directory, + # prefix module name with 'X'. + + case "${SOURCE}" in + ../*) MODULE=`db2_name "X${MODULE}"` + ;; + esac + + make_module "${MODULE}" "${SOURCE}" "${PGMDFNS}" + if action_needed "${PGMIFSNAME}" "${MODIFSNAME}" + then LINK=yes + fi + ;; + esac + done + + # Link program if needed. + + if [ "${LINK}" ] + then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`" + for ARG in ${PGMLDADD} + do case "${ARG}" in + -*) ;; # Ignore non-module. + *) MODULES="${MODULES} "`db2_name "${ARG}"` + ;; + esac + done + MODULES="`echo \"${MODULES}\" | + sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`" + CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})" + CMD="${CMD} ENTMOD(${TARGETLIB}/CURLMAIN)" + CMD="${CMD} MODULE(${MODULES} ${MODS})" + CMD="${CMD} BNDSRVPGM(${SRVPGMS} QADRTTS)" + CMD="${CMD} TGTRLS(${TGTRLS})" + CLcommand "${CMD}" + fi + done +} + + +# Build programs in the server directory. + +( + cd server + get_make_vars Makefile.inc + build_all_programs "${TARGETLIB}/OS400SYS" +) + + +# Build all programs in the libtest subdirectory. + +( + cd libtest + get_make_vars Makefile.inc + + # Special case: redefine chkhostname compilation parameters. + + chkhostname_SOURCES=chkhostname.c + chkhostname_LDADD=curl_gethostname.o + + build_all_programs "" "${TARGETLIB}/${SRVPGM}" +) diff --git a/tests/server/disabled.c b/tests/server/disabled.c index a9b43b8355..82fa854e3f 100644 --- a/tests/server/disabled.c +++ b/tests/server/disabled.c @@ -91,9 +91,13 @@ static const char *disabled[]={ NULL }; -int main(void) +int main(int argc, char **argv) { int i; + + (void) argc; + (void) argv; + for(i = 0; disabled[i]; i++) printf("%s\n", disabled[i]);