Skip to content
Martin Guy edited this page Apr 25, 2017 · 4 revisions

Here are the notes I made while trying to run xvi under the OpenGroup's VSC POSIX test suite.

#! /bin/sh

#
# How to  install/run the OpenGroup VSC POSIX Unix Utilities test suite
# and run the "vi" test suite against xvi.
#
# Long story short:
# - It needs fixing in several places to be compilable.
# - Configuring it requires answering dozens of bizarre questions but for vi
#   you can get away with giving it random answers to most of them.
# - It doesn't work on Linux, refusing to run most of the vi tests because
#   "getconf POSIX2_UPE" returns "undefined" on Linux systems.
# - It is runnable on AIX, but only tests the contents of the files vi saves,
#   not the correctness of screen output.
# 

echo "This isn't a shell script. It just looks like one." 1>&2
exit 1

#
# TET3 installation
#

wget http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8-src.tar.gz
wget http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8A-src.tar.Z
gunzip < tet3.8-src.tar.gz | tar xf -
mv tet3.8/* .
rmdir tet3.8
rm -f src/tet3/dtet2lib/putenv.c
rm -f src/tet3/dtet2lib/shared.mk
uncompress < tet3.8A-src.tar.Z | tar xf -

# The installation guide for TET is at
# http://tetworks.opengroup.org/documents/3.8/iguide_unix.pdf
(
    echo ''
    echo 'TET_ROOT=$HOME'
    echo 'export TET_ROOT'
) >> ~/.profile
. ~/.profile

# TET's "configure" script fails on AIX7.2, saying
# "configure: Unable to determine the OS type", so...
cd src

# The script tries to use "c89" as the compiler. Use the right one.
sed 's/c89$/gcc/' < defines/aix43.mk > defines.mk
echo lite | sh tetconfig

# TET has a local function "getline()" whose name conflicts with a system
# function of the same name in AIX's stdio (but don't rename ungetline())
sed 's/\([^n]\)getline/\1my_getline/' < tet3/tcc/scen1.c > x && mv -f x tet3/tcc/scen1.c

make install
cd ..

#
# VSC installation.
#

# You need a copy of VSC5312-PCTS.tar.Z frpm OpenGroup.
# See http://www.opengroup.org/testing/testsuites/vscpcts2003.htm

uncompress < VSC5312-PCTS.tar.Z | tar xf -
cd vsc

# I don't have root on the target system and we don't need it so jolly it along.
rm -f privscript
echo "exit 0" > privscript

{ echo gcc; yes '' } | sh buildconf

# Compilation of the tcl8.4 included in TET dies saying:
#	ld: 0711-317 ERROR: Undefined symbol: .__moddi3
#	ld: 0711-317 ERROR: Undefined symbol: .__divdi3
# and the latest tcl, tcl8.6, doesn't work either, saying
#	ld: -l tcl8.6 not found
# so get the most recent version of tcl8.4

cd
wget ftp://ftp.tcl.tk/pub/tcl/tcl8_4/tcl8.4.20-src.tar.gz
# This hung on AIX at the PASV... step, so I had to fetch it in a browser
# locally and then upload it with scp.

# Unpack the new tcl
cd vsc/Src/Interact
mv tcl tcl.dist
gunzip < ~/tcl8.4.20-src.tar.gz | tar xf -
ln -s tcl8.4.20 tcl
cd ../..

# The included of "expect" doesn't compile, saying
#	vsc/Src/Interact/tcl/generic/tclPort.h:22:28: fatal error:
#	tclUnixPort.h: No such file or directory
# so add the right include directory.
echo "TCL_CDEFS = -I$HOME/vsc/Src/Interact/tcl/unix" >> defines.mk

make

# Set VSC's environment variables
echo ". $TET_ROOT/vsc/SOURCE_ME" >> $HOME/.profile
. $HOME/.profile

#
# Configure VSC.
# Dozens of weird questions, most of which it would do better to interrogate
# the system itself to get the right answers.
# I just gave rubbish answers to most of the questions as they don't
# affect the vi tests. You may need to create a text file (say "charmap")
# for it containing:
#	ABCDEFGHIJKLMNOPQRSTUVWXYZ
#	abcdefghijklmnopqrstuvwxyz
#	0123456789.,
#

cd $HOME/vsc
sh configure

# Build the testsuite
tcc -bp


# Run the vi tests against the system vi
cd $HOME/vsc
tcc -epl /tset/POSIX.upe/vi/vi_01.ex
tcc -epl /tset/POSIX.upe/vi/vi_02.ex
tcc -epl /tset/POSIX.upe/vi/vi_03.ex
tcc -epl /tset/POSIX.upe/vi/vi_04.ex
tcc -epl /tset/POSIX.upe/vi/vi_05.ex
tcc -epl /tset/POSIX.upe/vi/vi_06.ex
mv results results-system-vi


# Install xvi as "vi"
cd
git clone git:/github.com/martinwguy/xvi
cd xvi/src
make -f makefile.aix CC=gcc
cp -p src/xvi $HOME/bin/vi
# Make sure our vi is preferred the system one
{
    echo ''
    echo 'PATH=$HOME/bin:$PATH'
    echo 'export PATH'
} >> $HOME/.profile
. $HOME/.profile

# Run the vi tests against xvi
tcc -epl /tset/POSIX.upe/vi/vi_01.ex
tcc -epl /tset/POSIX.upe/vi/vi_02.ex
tcc -epl /tset/POSIX.upe/vi/vi_03.ex
tcc -epl /tset/POSIX.upe/vi/vi_04.ex
tcc -epl /tset/POSIX.upe/vi/vi_05.ex
tcc -epl /tset/POSIX.upe/vi/vi_06.ex

# RESULTS

# The first test group, vi_01, completes against the system vi but sends xvi
# into an infinite loop and doesn't time it out and kill it.
# Killing -HUP the vi process lets the test
# The test hangs at:

USER          PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND
martin   13828418  0.0  0.0  528  828 pts/11 A    19:09:31  0:00 tcc -epl /tset
martin    4653764  0.0  0.0 1568  468 pts/11 A    19:09:32  0:00 sh vi_01.ex 
martin    5571420  0.0  0.0 1740  640 pts/11 A    19:09:33  0:00 sh vi_01.ex 
martin   10027672  0.8  0.0  424  636 pts/11 A    19:09:33 264:00 vi 

and again at:

ER          PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND
martin   13828418  0.0  0.0  528  828 pts/11 A    19:09:31  0:00 tcc -epl /tset
martin    4653764  0.0  0.0 1548  436 pts/11 A    19:09:32  0:00 sh vi_01.ex 
martin    5571430  0.0  0.0 1632  520 pts/11 A    03:22:34  0:00 sh vi_01.ex 
martin   10027680  0.0  0.0  104  156 pts/11 A    03:22:34  0:00 ga05 system vi
martin    8716766  0.9  0.0  424  636 pts/11 A    03:22:34 12:05 vi 

and again running "ga05 popen vi" due to a bug in xvi.
If you kill vi in the three tests where this happens, the test runs to completion.
Clone this wiki locally