Skip to content
Snippets Groups Projects
Commit 12e3ce6c authored by rds's avatar rds
Browse files

first commit of new test script

parent 93ecde1f
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
SCRIPT_NAME=$(basename $0)
INITIAL_DIR=$(pwd)
SCRIPT_DIR=$(dirname $0)
if ! echo $SCRIPT_DIR | egrep -q "(^)/" ; then
BASE_DIR=$INITIAL_DIR/$SCRIPT_DIR
else
BASE_DIR=$SCRIPT_DIR
fi
. $BASE_DIR/zmap_functions.sh || { echo "Failed to load zmap_functions.sh"; exit 1; }
set -o history
. $BASE_DIR/build_config.sh || { echo "Failed to load build_config.sh"; exit 1; }
while getopts ":r:" opt ; do
case $opt in
# t ) TAR_FILE=$OPTARG ;;
r ) RELEASE_LOCATION=$OPTARG ;;
\? ) zmap_message_exit "$usage"
esac
done
shift $(($OPTIND - 1))
# including VARIABLE=VALUE settings from command line
if [ $# -gt 0 ]; then
eval "$*"
fi
[ -n "$RELEASE_LOCATION" ] || {
zmap_message_err "RELEASE_LOCATION not set. Setting to '.'"
RELEASE_LOCATION=.
}
: # ; mkdir -p Linux_i686
: # ; cd Linux_i686
: # ; ln -s ../../src/build/linux bin
: # ; cd bin
: # ; ln -s /nfs/team71/acedb/zmap/BUILDS/ZMap.0-1-55.BUILD/Linux_i686/bin/sgifaceserver sgifaceserver
# Load the x11_functions
. $BASE_DIR/zmap_x11_functions.sh
#unset DISPLAY
zmap_x11_save_enviroment
zmap_x11_examine_environment
zmap_x11_get_xserver
X_APP=x-window-manager
#X_APP=xlogo
# print out lots of information here.
# DISPLAY=$DISPLAY
# XAUTHORITY=$XAUTHORITY
zmap_x11_check_xserver
zmap_message_out "waiting for the server to start..."
sleep 5
zmap_message_out "...running $X_APP"
$X_APP &
X_APP_PID=`pidof $X_APP`
[ "x$X_APP_PID" == "x" ] && zmap_message_exit "Failed running $X_APP..."
# Set the file names
ZMAP_CONFIG=/tmp/$USER.ZMap
COMMAND_FILE=${USER}-xremote_gui.cmd
CONFIG_FILE=${USER}-xremote.ini
# Set variables for the files
PROGRAM_PATH=$RELEASE_LOCATION/$(uname -ms | sed -e "s/ /_/g")/bin
SEQUENCE=20.2748056-2977904
DATABASE_LOCATION=~/acedb_sessions/$SEQUENCE
PORT=24321
NEW_FEATURE=__new_feature_name__
OLD_FEATURE=__old_feature_name__
CONTEXT_DUMP=context.dump
CONTEXT_FORMAT=context
# Actually write the files
# The zmap config file that zmap reads
# N.B. Substitution _will_ occur in this HERE doc.
cat <<EOF > $ZMAP_CONFIG || zmap_message_exit "Failed to write '$ZMAP_CONFIG'"
[ZMap]
show_mainwindow=true
EOF
# The config file the xremote_gui reads
# N.B. Substitution _will_ occur in this HERE doc.
cat <<EOF > $CONFIG_FILE || zmap_message_exit "Failed to write '$CONFIG_FILE'"
[programs]
zmap-exe=$PROGRAM_PATH/zmap
zmap-options=--conf_dir /tmp --conf_file $USER.ZMap
sgifaceserver-exe=$PROGRAM_PATH/sgifaceserver
sgifaceserver-options=-readonly $DATABASE_LOCATION $PORT 0:0
EOF
# The command file that xremote_gui reads
# N.B. Substitution _will_ occur in this HERE doc.
cat <<EOF > $COMMAND_FILE || zmap_message_exit "Failed to write '$COMMAND_FILE'"
<zmap action="new_zmap" />
__EOC__
<zmap action="new_view">
<segment sequence="$SEQUENCE" start="1" end="0">
[ZMap]
sources=source
[source]
url=acedb://any:any@localhost:24321
use_methods=true
featuresets=coding trf transcript est_human
</segment>
</zmap>
__EOC__
EOF
# Now run the xremote_gui command, which should look like
# xremote_gui --config-file ../../../scripts/xremote.ini --command-file ../../../scripts/xremote_gui.cmd
$PROGRAM_PATH/xremote_gui \
--config-file $CONFIG_FILE \
--command-file $COMMAND_FILE || zmap_message_exit "Failed runing xremote_gui"
# Now there should be
# a) a dumpfile
# b) no xremote_gui process
# c) no zmap process
# d) no sgifaceserver process
zmap_x11_restore_enviroment
kill -9 $X_APP_PID
zmap_message_out "Reached end of '$SCRIPT_NAME'"
exit 0;
#!/bin/echo dot script. please source
X11_ENVIRONMENT_FILE=/tmp/zmap.$$.env
XSERVER_PATH=Xvnc
XSERVER_OPTIONS="-terminate -desktop ${USER}-running-$SCRIPT_NAME"
XSERVER_ADD_OPTIONS="-rfbauth $HOME/.vnc/passwd"
VNC_PASSWD=tesswheat
# ah, test suite
# Do we need this?
function zmap_x11_restore_enviroment
{
zmap_message_out "restore environment?"
# . $X11_ENVIRONMENT_FILE
rm -f $X11_ENVIRONMENT_FILE
}
function zmap_x11_message_exit
{
zmap_message_err "$@"
zmap_x11_restore_enviroment
exit 1;
}
function zmap_x11_save_enviroment
{
zmap_message_out "save environment?"
# declare -p DISPLAY XAUTHORITY > $X11_ENVIRONMENT_FILE
}
function zmap_x11_examine_environment
{
NO_X_CONN=0
NO_DISPLAY=0
NO_SSH=0
[ -n "$XAUTHORITY" ] || {
zmap_message_out "XAUTHORITY unset, setting..."
XAUTHORITY=$HOME/.Xauthority
zmap_message_out "set to '$XAUTHORITY'"
}
[ -O $XAUTHORITY ] || {
zmap_message_out "Cannot access $XAUTHORITY"
# No valid connection can be made
NO_X_CONN=1
# need to start an xserver
DISPLAY=""
unset DISPLAY
}
if [ -z "$DISPLAY" ]; then
# We''l need to start an xserver
zmap_message_out "No DISPLAY variable set."
NO_DISPLAY=1
DISPLAY=:4
export DISPLAY
else
if [ "x$DISPLAY" == ":0.0" ]; then
zmap_message_out "Looks like xserver is accessible."
NO_SSH=1
else
zmap_message_out "Looks like xserver is accessible. (Forwarded)"
NO_SSH=0
fi
fi
}
function zmap_x11_get_xserver
{
if [ "x$NO_DISPLAY" == "x1" ]; then
zmap_message_out "Starting Xserver [$XSERVER_PATH]"
$XSERVER_PATH $DISPLAY $XSERVER_OPTIONS $XSERVER_ADD_OPTIONS &
else
zmap_message_out "Using current xserver"
fi
}
# print out lots of information here.
# DISPLAY=$DISPLAY
# XAUTHORITY=$XAUTHORITY
function zmap_x11_check_xserver
{
zmap_message_out "Variables look like:"
declare -p DISPLAY XAUTHORITY
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment