Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

it works again #5

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions eu.esrf.test/global_script_esrf/dawn_global_startup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
DAWN_WORKSPACE_ROOT="/scisoft/jenkins/ub1004_jonathan/workspace"
import os, shutil
from datetime import datetime
DAWN_WORKSPACE_ROOT=os.path.join(os.environ['WORKSPACE'],"eu.esrf.test/dawn_workspace")
DAWN_SUITE_WORKSPACE="suite_test_single_workspace"
USE_ATTACH=False

testSettings.logScreenshotOnFail = True
testSettings.logScreenshotOnError = True

import os, shutil
from datetime import datetime


def startDAWNSuiteWorkspace():

Expand Down
64 changes: 64 additions & 0 deletions eu.esrf.test/squishinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
set -o posix # posix mode so that error setting inherit to subshells
set -eux # error, unset and echo


# Options
export AUT_NAME=dawn
export AUT_DIR=/scisoft/jenkins/dawn/master_nightly/linux_x64/dawn
echo "WORKSPACE", ${WORKSPACE:="./WORKSPACE"}
echo "AUT_NAME=${AUT_NAME}"
echo "DISPLAY", ${DISPLAY:=":0.0"}\

export JREDIR=/sware/isdd/soft/java/v7u40/linux_x64/jdk1.7.0_40/jre


# Install squish in the Guest, $1 should be guest's JRE directory, $2 the aut name, $3 aut directory
# Sets SQUISHDIR (essentially as return)
function install_squish()
{
echo "`date +"%a %d/%b/%Y %H:%M:%S"` install_squish start"
local jredir=$1
local aut_name=$2
local aut_dir=$3
local java="${jredir}/bin/java"

unzip -q -d $WORKSPACE/tempsquish /scisoft/jenkins/Squish_SourceFiles/squish.zip
: Remove version from folder name
mv $WORKSPACE/tempsquish/* $WORKSPACE/squish
rmdir $WORKSPACE/tempsquish

## Setup squish
# This is essentially the command that is run by the UI setup in Squish to create the magic squishrt.jar
SQUISHDIR="$WORKSPACE/squish"
local squishserver="$SQUISHDIR/bin/squishserver"
java_version=`"$java" -version 2>&1 | grep 'java version' | sed '-es,[^"]*"\([^"]*\)",\1,'`
echo "`date +"%a %d/%b/%Y %H:%M:%S"` install_squish FixMethod"
"$java" \
-classpath "${SQUISHDIR}/lib/squishjava.jar:${SQUISHDIR}/lib/bcel.jar" \
com.froglogic.squish.awt.FixMethod \
"${jredir}/lib/rt.jar:${SQUISHDIR}/lib/squishjava.jar" \
"${SQUISHDIR}/lib/squishrt.jar"

cp "/scisoft/sware_isdd/src/squish/.squish-3-license" ~/.squish-3-license
$squishserver --config setJavaVM "$java"
$squishserver --config setJavaVersion "$java_version"
$squishserver --config setJavaHookMethod "jvm"
$squishserver --config setLibJVM "`find $jredir -name libjvm.so | head -1`"
$squishserver --config addAUT "$aut_name" "$aut_dir"
$squishserver --config setAUTTimeout 120
echo "`date +"%a %d/%b/%Y %H:%M:%S"` install_squish end"
}

: Setup Squish
if !([ -d "$WORKSPACE/squish" ]);
then
install_squish $JREDIR $AUT_NAME $AUT_DIR
else
echo "*****************************"
echo "************ALREADY EXIST*****************"
echo "*****************************"
fi



4 changes: 2 additions & 2 deletions eu.esrf.test/src/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
listing = os.listdir(logpath)

time= time.strftime('%d_%m_%y(%H:%M)',time.localtime())
#logfile = open("/scisoft/jenkins/ub1004_jonathan/workspace/Dawn_squish_tests/squish_tst_"+time+".txt", "a")


for infile in sorted(listing):
#f = open('/scisoft/jenkins/ub1004_jonathan/workspace/Dawn_squish_tests/log/'+infile)

f = open(os.path.join(logpath,infile))
strData = f.read()
f.close()
Expand Down
48 changes: 48 additions & 0 deletions eu.esrf.test/src/scriptFunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
xvfbFound=false
i=0
x=0
typeFile=".X*-lock" #pattern to only select Xvfb tmp file
path=/tmp/.X*-lock
findDisplayNumber(){
if [ -f "$1/.X0-lock" ]; #if no display root
then
for inode in $(ls $1/$typeFile)
do
owner=$(ls -al $inode | grep -v grep | awk '{ print $3; }')
array[$i]=$(echo "$inode" | tr -d [:alpha:] | tr -d [:punct:]) #make a list of all the display number for, in another case find a free number
if [ "$USER" = "$owner" ];then
xvfbFound=true
var=$(echo "$inode" | tr -d [:alpha:] | tr -d [:punct:])
echo $var #return the availaible display for the logged user
break;
fi
let i++
done

if ! $xvfbFound ; then #if no display found
var1=${#array[@]}
for (( c=0; c<var1; c++ ))
do
if [ $x -ne ${array[$c]} ];then
var=$x
xvfbFound=true
echo $var #if no display is already created, this function will return a free number display
break;
fi
let x++
done
fi
if ! $xvfbFound ;
then
var=$x
echo $var
fi



else
var=0
echo $var
fi
}
21 changes: 14 additions & 7 deletions eu.esrf.test/src/script_jenkins
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/bin/sh
Xvfb :2 &
export DISPLAY=:2
export PATH=/sware/isdd/soft/java/v7u17/linux_x64/jdk1.7.0_17/bin:$PATH
cd /scisoft/jenkins/ub1004_jonathan/squish-4.2.3-java-linux64/bin/
./squishserver &>/$WORKSPACE/serverlog
#!/usr/bin/env bash

source scriptFunction
var=$(findDisplayNumber /tmp/) #the argument is the path to yours temp files.


Xvfb :$var -screen 0 1024x768x16 & #create a display
export DISPLAY=:$var
export PATH=/sware/isdd/soft/java/v7u17/linux_x64/jdk1.7.0_40/bin:$PATH
cd /$WORKSPACE/squish/bin/
./squishserver & >/$WORKSPACE/serverlog
sleep 1
/scisoft/jenkins/ub1004_jonathan/squish-4.2.3-java-linux64/bin/squishrunner --testsuite /scisoft/jenkins/ub1004_jonathan/workspace/Dawn_squish_tests/org.dawnsci.squishtests/$1/ --testcase $2/ --useWaitFor>>/$WORKSPACE/log/$1_squishlog
#run the test (with $1 corresponding at the testsuite and $2 corresponding at the testcase)
/$WORKSPACE/squish/bin/squishrunner --testsuite $WORKSPACE/org.dawnsci.squishtests/$1/ --testcase $2/ --useWaitFor>>/$WORKSPACE/log/#$1_squishlog
var1=$(ps -aef |grep squishserver | grep -v grep | awk '{ print $2; }' | head -1)
kill -9 $var1
var2=$(ps -aef |grep Xvfb | grep -v grep | awk '{ print $2; }' | head -1)
kill -9 $var2


214 changes: 214 additions & 0 deletions eu.esrf.test/src/shunit2-2.1.6/doc/CHANGES-2.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
Changes in shUnit2 2.1.X
========================

Changes with 2.1.6
------------------

Removed all references to the DocBook documentation.

Simplified the 'src' structure.

Fixed error message in fail() that stated wrong number of required arguments.

Updated lib/versions.

Fixed bug in _shunit_mktempDir() where a failure occurred when the 'od' command was not present in /usr/bin.

Renamed shunit_tmpDir variable to SHUNIT_TMPDIR to closer match the standard
TMPDIR variable.

Added support for calling shunit2 as an executable, in addition to the existing
method of sourcing it in as a library. This allows users to keep tests working
despite the location of the shunit2 executable being different for each OS
distribution.

Issue #14: Improved handling of some strange chars (e.g. single and double
quotes) in messages.

Issue# 27: Fixed error message for assertSame().

Issue# 25: Added check and error message to user when phantom functions are
written to a partition mounted with noexec.

Issue# 11: Added support for defining functions like 'function someFunction()'.


Changes with 2.1.5
------------------

Issue# 1: Fixed bug pointed out by R Bernstein in the trap code where certain
types of exit conditions did not generate the ending report.

Issue# 2: Added assertNotEquals() assert.

Issue# 3: Moved check for unset variables out of shUnit2 into the unit tests.
Testing poorly written software blows up if this check is in, but it is only
interesting for shUnit2 itself. Added shunit_test_output.sh unit test for this.
Some shells still do not catch such errors properly (e.g. Bourne shell and BASH
2.x).

Added new custom assert in test_helpers to check for output to STDOUT, and none
to STDERR.

Replaced fatal message in the temp directory creation with a _shunit_fatal()
function call.

Fixed test_output unit test so it works now that the 'set -u' stuff was removed
for Issue# 3.

Flushed out the coding standards in the README.txt a bit more, and brought the
shunit2 code up to par with the documented standards.

Issue# 4: Completely changed the reporting output to be a closer match for
JUnit and PyUnit. As a result, tests are counted separately from assertions.

Provide public shunit_tmpDir variable that can be used by unit test scripts that
need automated and guaranteed cleanup.

Issue# 7: Fixed duplicated printing of messages passed to asserts.

Per code review, fixed wording of failSame() and failNotSame() messages.

Replaced version_info.sh with versions library and made appropriate changes in
other scripts to use it.

Added gen_test_results.sh to make releases easier.

Fixed bugs in shlib_relToAbsPath() in shlib.

Converted DocBook documentation to reStructuredText for easier maintenance. The
DocBook documentation is now considered obsolete, and will be removed in a
future release.

Issue# 5: Fixed the documentation around the usage of failures.

Issue# 9: Added unit tests and updated documentation to demonstrate the
requirement of quoting values twice when macros are used. This is due to how
shell parses arguments.

When an invalid number of arguments is passed to a function, the invalid number
is returned to the user so they are more aware of what the cause might be.


Changes with 2.1.4
------------------

Removed the _shunit_functionExists() function as it was dead code.

Fixed zsh version number check in version_info.

Fixed bug in last resort temporary directory creation.

Fixed off-by-one in exit value for scripts caught by the trap handler.

Added argument count error checking to all functions.

Added mkdir_test.sh example.

Moved src/test into src/shell to better match structure used with shFlags.

Fixed problem where null values were not handled properly under ksh.

Added support for outputting line numbers as part of assert messages.

Started documenting the coding standards, and changed some variable names as a
result.

Improved zsh version and option checks.

Renamed the __SHUNIT_VERSION variable to SHUNIT_VERSION.


Changes with 2.1.3
------------------

Added some explicit variable defaults, even though the variables are set, as
they sometimes behave strange when the script is canceled.

Additional workarounds for zsh compatibility.

shUnit2 now exits with a non-zero exit code if any of the tests failed. This was
done for automated testing frameworks. Tests that were skipped are not
considered failures, and do not affect the exit code.

Changed detection of STDERR output in unit tests.


Changes with 2.1.2
------------------

Unset additional variables that were missed.

Added checks and workarounds to improve zsh compatibility.

Added some argument count checks ``assertEquals()``, ``assertNull()``, and
``assertSame()``


Changes with 2.1.1
------------------

Fixed bug where ``fail()`` was not honoring skipping.

Fixed problem with ``docs-docbook-prep`` target that prevented it from working.
(Thanks to Bryan Larsen for pointing this out.)

Changed the test in ``assertFalse()`` so that any non-zero value registers as
false. (Credits to Bryan Larsen)

Major fiddling to bring more in line with `JUnit <http://junit.org/>`. Asserts
give better output when no message is given, and failures now just fail.

It was pointed out that the simple 'failed' message for a failed assert was not
only insufficient, it was nonstandard (when compared to JUnit) and didn't
provide the user with an expected vs actual result. The code was revised
somewhat to bring closer into alignment with JUnit (v4.3.1 specifically) so
that it feels more "normal". (Credits to Richard Jensen)

As part of the JUnit realignment, it was noticed that fail*() functions in
JUnit don't actually do any comparisons themselves. They only generate a
failure message. Updated the code to match.

Added self-testing unit tests. Kinda horkey, but they did find bugs during the
JUnit realignment.

Fixed the code for returning from asserts as the return was being called before
the unsetting of variables occurred. (Credits to Mathias Goldau)

The assert(True|False)() functions now accept an integer value for a
conditional test. A value of '0' is considered 'true', while any non-zero value
is considered 'false'.

All public functions now fill use default values to work properly with the '-x'
shell debugging flag.

Fixed the method of percent calculation for the report to get achieve better
accuracy.


Changes with 2.1.0 (since 2.0.1)
--------------------------------

This release is a branch of the 2.0.1 release.

Moving to `reStructured Text <http://docutils.sourceforge.net/rst.html>`_ for
the documentation.

Fixed problem with ``fail()``. The failure message was not properly printed.

Fixed the ``Makefile`` so that the DocBook XML and XSLT files would be
downloaded before parsing can continue.

Renamed the internal ``__SHUNIT_TRUE`` and ``__SHUNIT_FALSE`` variables to
``SHUNIT_TRUE`` and ``SHUNIT_FALSE`` so that unit tests can "use" them.

Added support for test "skipping". If skipping is turned on with the
``startSkip()`` function, ``assert`` and ``fail`` functions will return
immediately, and the skip will be recorded.

The report output format was changed to include the percentage for each test
result, rather than just those successful.


.. $Revision: 326 $
.. vim:fileencoding=latin1:ft=text:spell:tw=80
Loading