Skip to content

Commit

Permalink
add lsb_vsx testsuite
Browse files Browse the repository at this point in the history
JIRA: CI-138
  • Loading branch information
adamdebek committed Oct 17, 2024
1 parent 549e10b commit 57aebab
Show file tree
Hide file tree
Showing 31 changed files with 5,097 additions and 0 deletions.
1 change: 1 addition & 0 deletions .codespell_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ans
36 changes: 36 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,40 @@ for port in "${ports[@]}"; do
)
done

[ "${PORTS_ZLIB}" = "y" ] && ./phoenix-rtos-ports/zlib/build.sh

[ "${PORTS_LIGHTTPD}" = "y" ] && ./phoenix-rtos-ports/lighttpd/build.sh

[ "${PORTS_DROPBEAR}" = "y" ] && ./phoenix-rtos-ports/dropbear/build.sh

[ "${PORTS_LUA}" = "y" ] && ./phoenix-rtos-ports/lua/build.sh

[ "${PORTS_LZO}" = "y" ] && ./phoenix-rtos-ports/lzo/build.sh

[ "${PORTS_OPENVPN}" = "y" ] && ./phoenix-rtos-ports/openvpn/build.sh

[ "${PORTS_CURL}" = "y" ] && ./phoenix-rtos-ports/curl/build.sh

[ "${PORTS_JANSSON}" = "y" ] && ./phoenix-rtos-ports/jansson/build.sh

[ "${PORTS_MICROPYTHON}" = "y" ] && ./phoenix-rtos-ports/micropython/build.sh

[ "${PORTS_SSCEP}" = "y" ] && ./phoenix-rtos-ports/sscep/build.sh

[ "${PORTS_WPA_SUPPLICANT}" = "y" ] && ./phoenix-rtos-ports/wpa_supplicant/build.sh

[ "${PORTS_LIBEVENT}" = "y" ] && ./phoenix-rtos-ports/libevent/build.sh

[ "${PORTS_OPENIKED}" = "y" ] && ./phoenix-rtos-ports/openiked/build.sh

[ "${PORTS_AZURE_SDK}" = "y" ] && ./phoenix-rtos-ports/azure_sdk/build.sh

[ "${PORTS_PICOCOM}" = "y" ] && ./phoenix-rtos-ports/picocom/build.sh

[ "${PORTS_COREMARK}" = "y" ] && ./phoenix-rtos-ports/coremark/build.sh

[ "${PORTS_FS_MARK}" = "y" ] && ./phoenix-rtos-ports/fs_mark/build.sh

[ "${PORTS_LSB_VSX}" = "y" ] && ./phoenix-rtos-ports/lsb_vsx/build.sh

exit 0
169 changes: 169 additions & 0 deletions lsb_vsx/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#!/usr/bin/env bash

# TODO: Incremental build

set -e

LSB_VSX_VER="2.0-1"
LSB_VSX="lsb_vsx-$LSB_VSX_VER"

PREFIX_LSB_VSX="${PREFIX_PROJECT}/phoenix-rtos-ports/lsb_vsx"
PREFIX_LSB_VSX_BUILD="${PREFIX_BUILD}/lsb_vsx"
PREFIX_LSB_VSX_MARKERS="${PREFIX_LSB_VSX_BUILD}/markers"
PREFIX_LSB_VSX_FILES="${PREFIX_LSB_VSX_BUILD}/files"
PREFIX_ROOTFS_LSB_VSX="${PREFIX_ROOTFS}/usr/test/lsb-vsx"

apply_patches() {
local patchfile

for patchfile in "${PREFIX_LSB_VSX}/patches/${1}/"*.patch; do
patch_basename=$(basename "$patchfile")
patch_dirname=$(basename $(dirname "$patchfile"))
if [ ! -f "${PREFIX_LSB_VSX_MARKERS}/${patch_dirname}/${patch_basename}.applied" ]; then
echo "applying patch: $patchfile"
patch -d "${PREFIX_LSB_VSX_BUILD}/files" -p1 < "$patchfile"
touch "${PREFIX_LSB_VSX_MARKERS}/${patch_dirname}/${patch_basename}.applied"
fi
done
}

b_log "Building lsb-vsx testsuite"

mkdir -p "$PREFIX_LSB_VSX_BUILD"
mkdir -p "$PREFIX_LSB_VSX_MARKERS"
mkdir -p "${PREFIX_LSB_VSX_MARKERS}/host_TETware"
mkdir -p "${PREFIX_LSB_VSX_MARKERS}/host_VSX"
mkdir -p "${PREFIX_LSB_VSX_MARKERS}/ps_TETware"
mkdir -p "${PREFIX_LSB_VSX_MARKERS}/ps_VSX"
mkdir -p "$PREFIX_LSB_VSX_FILES"
mkdir -p "${PREFIX_LSB_VSX_BUILD}/host_bin"
mkdir -p "${PREFIX_PROG_STRIPPED}/lsb_vsx"

#
# # Download and extract packages
#

[ -f "${PREFIX_LSB_VSX}/packages/tet_vsxgen_3.02.tgz" ] || \
wget http://www.opengroup.org/infosrv/lsb/ogdeliverables/LSB-VSX2.0-1/tet_vsxgen_3.02.tgz -P "${PREFIX_LSB_VSX}/packages"

[ -f "${PREFIX_LSB_VSX}/packages/lts_vsx-pcts2.0beta.tgz" ] || \
wget http://www.opengroup.org/infosrv/lsb/ogdeliverables/LSB-VSX2.0-1/lts_vsx-pcts2.0beta.tgz -P "${PREFIX_LSB_VSX}/packages"

if [ ! -d "${PREFIX_LSB_VSX_FILES}/src" ]; then
tar xzf "${PREFIX_LSB_VSX}/packages/tet_vsxgen_3.02.tgz" -C "$PREFIX_LSB_VSX_FILES"
tar xzf "${PREFIX_LSB_VSX}/packages/lts_vsx-pcts2.0beta.tgz" -C "${PREFIX_LSB_VSX_FILES}/test_sets"
fi

#
# # Compile TETware-Lite for host
#

TET_ROOT="$PREFIX_LSB_VSX_FILES"
PATH="${TET_ROOT}/bin:$PATH"
export TET_ROOT PATH

apply_patches "host_TETware"
echo -e "\n--- Compiling TETware-Lite for host ---\n"
cd "$TET_ROOT" && sh configure -t lite > /dev/null
cd "${TET_ROOT}/src" && make && make install
cp -p "${TET_ROOT}/bin/tcc" "${PREFIX_LSB_VSX_BUILD}/host_bin/tcc"

#
# # Build VSX test framework for host (vbuild only needed)
#

HOME="${TET_ROOT}/test_sets"
export HOME PREFIX_LSB_VSX

apply_patches "host_VSX"
cd "${TET_ROOT}/test_sets"
sh setup_testsets.sh
cp -p "${HOME}/BIN/vbuild" "${PREFIX_LSB_VSX_BUILD}/host_bin/vbuild"

#
# # Clean host build
#

rm -rf "${PREFIX_LSB_VSX_FILES}/"*
tar xzf "${PREFIX_LSB_VSX}/packages/tet_vsxgen_3.02.tgz" -C "$PREFIX_LSB_VSX_FILES"
tar xzf "${PREFIX_LSB_VSX}/packages/lts_vsx-pcts2.0beta.tgz" -C "${PREFIX_LSB_VSX_FILES}/test_sets"

#
# # Configure src/defines.mk (used by TETware)
#

COPTS=$(echo $CFLAGS | sed 's/-I[^ ]* //g')

sed -e "s|^CC =|CC = ${CC}|" \
-e "s|^LD_R =|LD_R = ${LD} -r|" \
-e "s|^LDFLAGS =|LDFLAGS = ${LDFLAGS}|" \
-e "s|^AR =|AR = ${AR}|" \
-e "s|^CDEFS =|CDEFS = -I${PREFIX_PROJECT}/_build/${TARGET}/sysroot/usr/include|" \
-e "s|^COPTS =|COPTS = ${COPTS}|" \
"${PREFIX_LSB_VSX}/config/ps_defines.mk" > "${PREFIX_LSB_VSX_FILES}/src/defines.mk"

#
# # Compile TETware-Lite for Phoenix-RTOS
#

TET_EXECUTE="${TET_ROOT}/test_sets/TESTROOT"
PATH="${TET_ROOT}/test_sets/BIN:${TET_EXECUTE}/BIN:$PATH"
HOME="${TET_ROOT}/test_sets"
export TET_EXECUTE PATH HOME

apply_patches "ps_TETware"
echo -e "\n--- Compiling TETware-Lite for Phoenix-RTOS ---\n"
cd "${TET_ROOT}/src"
sh tetconfig -t lite
make; make install

#
# # Configure ps_vsxparams file
#

VSXDIR="${HOME}/SRC"
TET_EXECUTE="${HOME}/TESTROOT"

sed -e "s|^CC=|CC=\"${CC}\"|" \
-e "s|^LDFLAGS=|LDFLAGS=\"${LDFLAGS}\"|" \
-e "s|^AR=|AR=\"${AR} cr\"|" \
-e "s|^RANLIB=|RANLIB=\"${CROSS}ranlib\"|" \
-e "s|^INCDIRS=|INCDIRS=\"${PREFIX_PROJECT}/_build/${TARGET}/sysroot/usr/include\"|" \
-e "s|^VSXDIR=|VSXDIR=\"${VSXDIR}\"|" \
-e "s|^TET_EXECUTE=|TET_EXECUTE=\"${TET_EXECUTE}\"|" \
"${PREFIX_LSB_VSX}/config/ps_vsxparams.skel" > "${PREFIX_LSB_VSX}/config/ps_vsxparams"

#
# # Build VSX test framework
#

apply_patches "ps_VSX"
cd "${TET_ROOT}/test_sets"
sh setup_testsets.sh

#
# # Build tests
#

PATH="${PREFIX_LSB_VSX_BUILD}/host_bin:$PATH"

echo -e "\n--- Building tests ---\n"
sed -e "s|^PATH=|PATH=\"${PATH}\"|" -i "${HOME}/tetbuild.cfg"
"${PREFIX_LSB_VSX_BUILD}/host_bin/tcc" -p -b -s "${PREFIX_LSB_VSX}/config/scen.bld"

#
# # Strip and copy to rootfs
#

find "$HOME" -type f -executable -name "T.*" -print0 | while IFS= read -r -d '' test_path; do
testroot_path="${test_path##*test_sets/}"
mkdir -p "$(dirname "${PREFIX_ROOTFS}/$testroot_path")"

if ! file "$test_path" | grep -q "ASCII text"; then
mkdir -p "$(dirname "${PREFIX_PROG_STRIPPED}lsb_vsx/$testroot_path")"
"$STRIP" -o "${PREFIX_PROG_STRIPPED}lsb_vsx/$testroot_path" "$test_path"
cp -p "${PREFIX_PROG_STRIPPED}lsb_vsx/$testroot_path" "${PREFIX_ROOTFS}/$testroot_path"
else
cp -p "$test_path" "${PREFIX_ROOTFS}/$testroot_path"
fi
done
169 changes: 169 additions & 0 deletions lsb_vsx/config/host_vsxparams
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#VSX_OPER - the name of the person running the VSX test suite
VSX_OPER="${USER:-Unknown}"

#VSX_ORG - the name of the organisation for whom VSX is being run
VSX_ORG="Phoenix Systems"

#VSX_SYS - the name of the system (hardware and software) on which the VSX
# verification is being performed
VSX_SYS="Unknown"

#TEST_MODE - the VSX test mode to be used
TEST_MODE="POSIX96"

#TEST_XNFS - indicates whether to test the XNFS specification
# The value should be "y" for XNFS testing, "n" for XSH testing.
TEST_XNFS="n"

#SUBSETS - a space-separated list of the subsets of VSX to be installed
# For example: "base dm"
SUBSETS="base"

#VSXDIR - this parameter defines the source directory for the VSX software.
# The value given to this parameter must be a full pathname
VSXDIR="${TET_ROOT}/test_sets/SRC"

#TET_EXECUTE - this parameter defines the directory from which the VSX tests
# will be executed.
# The value given to this parameter must be a full pathname
TET_EXECUTE="${TET_ROOT}/test_sets/TESTROOT"

#SPEED - this parameter defines the speed of the machine on a 1-10 scale
# A speed of 1 is given to a very fast machine and 10 to a very
# slow machine
SPEED="5"

#PATH - the command search path to be used when installing and building VSX.
# Normally set to the PATH in effect when config.sh was run.
# Must contain the directories where commands specified in other
# parameters reside (if full path names are not given).
PATH="$TET_ROOT/bin:$TET_ROOT/test_sets/BIN:$TET_ROOT/test_sets/TESTROOT/BIN:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin"

#INCDIRS - this parameter defines the directories which contain the include
# files for the system being tested, in order of searching.
# This parameter is normally set to /usr/include
INCDIRS="/usr/include"

#CC - this parameter defines the C compiler to be used in building the suite.
# This parameter is normally set to a pathname for c89 or cc.
# It must be set to (a pathname for) c89 for UNIX98 registration runs.
CC="/bin/cc"

#COPTS - this parameter defines any special command line options needed by the
# C compiler.
# This parameter is normally set to ""
# Set to -ansi with gcc to get a clean compiler namespace
COPTS="-ansi"

#THR_COPTS - this parameter defines C compiler options to be used instead of
# COPTS when compiling code that will be linked with the TETware
# thread-safe API library. The options must be compatible with those
# used in THR_COPTS in the TETware defines.mk file.
# This parameter is only needed by some subsets.
THR_COPTS=""

#DEFINES - feature test macros appropriate for the test mode
# This parameter is set automatically and should not need to be changed.
DEFINES="-D_POSIX_C_SOURCE=199506"

#LDFLAGS - this parameter defines any special link editor (loader) options
# needed by the C compiler link edit phase.
# This parameter is normally set to ""
LDFLAGS=""

#CFPURE - this parameter defines the link editor option used to produce a
# pure executable (shared text) program.
# This parameter is only needed by some subsets, and is not used
# when testing XNFS. Some systems require this parameter to be set
# to -n (non-X/Open option). Normally it is set to "".
CFPURE=""

#LORDER - this parameter defines the sequential object library ordering program.
# If the system has an archiver which does not need lorder this
# parameter should be set to "echo".
LORDER="echo"

#TSORT - topological sort program used in library ordering.
# If LORDER has been set to "echo", this parameter should be set to "cat".
# Otherwise this parameter should be set to "tsort"
TSORT="cat"

#RANLIB - this parameter defines the random object library ordering program.
# If this parameter is set to "ranlib", LORDER should be set to "echo"
# and TSORT set to "cat".
# Otherwise this parameter should be set to "echo"
RANLIB="ranlib"

#AR - the command (and options) used to create a library archive.
# This parameter is normally set to "ar cr"
AR="ar cr"

#CHOWN - the command used to change the ownership of files.
# This parameter is normally set to "chown" or "/etc/chown"
CHOWN="chown"

#CHGRP - the command used to change the group ownership of files.
# This parameter is normally set to "chgrp"
CHGRP="chgrp"

#CHMOD - the command used to change the mode of files
# This parameter is normally set to "chmod"
CHMOD="chmod"

#MLIB - the name of the mathematics library
# This parameter is only needed by some subsets, and is not used
# when testing XNFS. It is typically set to "/usr/lib/libm.a".
MLIB="-lm"

#RPCLIB - the name of the RPC library
# This parameter is only used when testing XNFS.
RPCLIB=""

#RPC_TYPE - whether the RPC library is TLI or socket-based
# This parameter must be set to "TLI" or "socket".
# This parameter is only used when testing XNFS.
RPC_TYPE=""

#SYSLIBS - the names of additional libraries needed to compile VSX
# These library names should be full path names.
# Typical libraries needed on this line are:-
# The library containing the directory routines
# The library containing the enhanced memory allocation routines
# The library containing the vprintf function
# The library containing the NLS routines
# The parameter should be of the form "/usr/lib/libnam1.a /lib/libnam3.a"
# This parameter will often be set to ""
SYSLIBS=""

#XNFS_CLIENT - the name of the XNFS client system
# This parameter is only used when testing XNFS.
XNFS_CLIENT=""

#XNFS_SERVER - the name of the XNFS server system
# This parameter is only used when testing XNFS.
XNFS_SERVER=""

#SERVER_TET_ROOT - the pathname of the TET_ROOT directory on the server
# This parameter is only used when testing XNFS.
SERVER_TET_ROOT=""

#NOSPC_DEV - the mountable device to be used for ENOSPC testing
# This parameter is only needed by some subsets, and is not used
# when testing XNFS.
NOSPC_DEV="NOSPC_DEV"

#VPRINTF_SUPP - indicates whether the ANSI function vprintf() is supported
# This parameter must be "y" in X/Open modes but may be "n" in
# POSIX and FIPS modes.
VPRINTF_SUPP="y"

#LONG_DOUBLE_SUPP - whether the compiler supports the "long double" type
# This parameter is not used when testing XNFS.
# This parameter must be set to "y" if long double is supported
LONG_DOUBLE_SUPP="y"

#SIGNAL_SUPP - indicates whether the ANSI function signal() is supported
# This parameter is not used when testing XNFS.
# This parameter must be "y" in X/Open modes but may be "n" in
# POSIX and FIPS modes.
SIGNAL_SUPP="y"
Loading

0 comments on commit 57aebab

Please sign in to comment.