]> git.evergreen-ils.org Git - working/random.git/blob - qa/test.sh
more organized archive folder
[working/random.git] / qa / test.sh
1 #!/bin/bash
2 . /home/live/.bashrc
3
4 export TARGET_USER=esi
5 export TARGET_HOST=192.168.25.129
6 export TARGET_PATH=/home/esi/
7 export LOCAL_QA_GIT_PATH=/home/live/git/random/
8 export LOCAL_QA_BRANCH=collab/phasefx/wheezy_installer
9 export LOCAL_HTML_PATH=/home/live/public_html/
10
11 echo -n "*** Changing to $LOCAL_QA_GIT_PATH ... "
12 cd $LOCAL_QA_GIT_PATH || exit -1
13 echo "location changed"
14
15 echo "*** Checking out $LOCAL_QA_BRANCH ..."
16 git checkout $LOCAL_QA_BRANCH || exit -1
17 git fetch --all || exit -1
18 git pull || exit -1
19 echo "*** Local branch updated"
20
21 echo "*** Pushing installer script to $TARGET_USER@$TARGET_HOST:$TARGET_PATH"
22 scp installer/wheezy/installer_installer.sh $TARGET_USER@$TARGET_HOST:$TARGET_PATH || exit -1
23 echo "*** Script pushed"
24
25 echo "*** Archiving previous test run"
26 cd $LOCAL_HTML_PATH || exit -1
27 export ARCHIVE_DIR=`date +%Y-%m` || exit -1
28 export ARCHIVE_SUBDIR=`date +%F_%T` || exit -1
29 mkdir -p archive/$ARCHIVE_DIR/$ARCHIVE_SUBDIR || exit -1
30 mv *.* archive/$ARCHIVE_DIR/$ARCHIVE_SUBDIR || exit -1
31 cp archive/$ARCHIVE_DIR/$ARCHIVE_SUBDIR/*.hash . || exit -1
32 echo "*** Test archived"
33
34 echo "*** Setting up new output"
35 cp $LOCAL_QA_GIT_PATH/qa/test_output.css .
36 echo '<html><head></head><body><h1>Testing in progress</h1>[<a href="archive/cronoutput.txt">test.sh output</a>][<a href="archive/">Previous Runs</a>]</body></html>' > test.html
37 ln -s test.html index.html
38 echo "*** Ready to test!"
39
40 echo -n "*** Test starting ... "
41 ssh $TARGET_USER@$TARGET_HOST $TARGET_PATH/installer_installer.sh &> output.txt
42 echo "test run complete."
43
44 echo "*** Creating web output"
45 $LOCAL_QA_GIT_PATH/qa/test_output_webifier.pl output.txt 
46