<commit_before>#!/bin/bash

set -x
set -e

DB_NAME=$BUILD_TAG
INSTANCE_NAME=$BUILD_TAG

SQLCMD=sqlcmd
COMPRESSED_BACKUP_EXE=V1SDKTests_sql_selfextract.exe
BACKUP_FILE=V1SDKTests.sql
V1_SETUP=VersionOne.Setup.exe
RESTORE_DB=true
# set by jenkins now (1/9/12) DB_SERVER="(local)"

cd $WORKSPACE/TestSetup
pwd

if [ $RESTORE_DB == "true" ]
then
    echo "Unpacking database backup from self-extracting archive"
    ./$COMPRESSED_BACKUP_EXE -y
    echo "Restoring database..."

    $SQLCMD -S $DB_SERVER -E -Q "IF  EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'$DB_NAME') DROP DATABASE [$DB_NAME]" >restore_db_and_install_v1.log
    $SQLCMD -S $DB_SERVER -E -Q "CREATE DATABASE [$DB_NAME]" >>restore_db_and_install_v1.log
    $SQLCMD -S $DB_SERVER -d $DB_NAME -E -i $BACKUP_FILE >>restore_db_and_install_v1.log
    echo "Removing DB Backup file"
fi

echo "Installing VersionOne at http://localhost/${INSTANCE_NAME} associated with DB Server: ${DB_SERVER} and DB Name: ${DB_NAME}..."

./$V1_SETUP -Quiet:2 -DbServer:$DB_SERVER -LogFile:$WORKSPACE\\TestSetup\\setup.log -DBName:$DB_NAME $INSTANCE_NAME

if [ $? -gt 0 ]
then 
  tail -50 $WORKSPACE/TestSetup/setup.log | grep Exception
else
    echo "Thank you, you can browse to http://localhost/$INSTANCE_NAME and login with admin / admin, and you should be able to execute the integration tests now..."
    
fi

<commit_msg>bail with error when we detect abnormal exit from V1Setup (becaue v1setup doesn't exit with error codes???)<commit_after>#!/bin/bash

set -x
set -e

DB_NAME=$BUILD_TAG
INSTANCE_NAME=$BUILD_TAG

SQLCMD=sqlcmd
COMPRESSED_BACKUP_EXE=V1SDKTests_sql_selfextract.exe
BACKUP_FILE=V1SDKTests.sql
V1_SETUP=VersionOne.Setup.exe
RESTORE_DB=true
# set by jenkins now (1/9/12) DB_SERVER="(local)"

cd $WORKSPACE/TestSetup
pwd

if [ $RESTORE_DB == "true" ]
then
    echo "Unpacking database backup from self-extracting archive"
    ./$COMPRESSED_BACKUP_EXE -y
    echo "Restoring database..."

    $SQLCMD -S $DB_SERVER -E -Q "IF  EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'$DB_NAME') DROP DATABASE [$DB_NAME]" >restore_db_and_install_v1.log
    $SQLCMD -S $DB_SERVER -E -Q "CREATE DATABASE [$DB_NAME]" >>restore_db_and_install_v1.log
    $SQLCMD -S $DB_SERVER -d $DB_NAME -E -i $BACKUP_FILE >>restore_db_and_install_v1.log
    echo "Removing DB Backup file"
fi

echo "Installing VersionOne at http://localhost/${INSTANCE_NAME} associated with DB Server: ${DB_SERVER} and DB Name: ${DB_NAME}..."

./$V1_SETUP -Quiet:2 -DbServer:$DB_SERVER -LogFile:$WORKSPACE\\TestSetup\\setup.log -DBName:$DB_NAME $INSTANCE_NAME

if [ $? -gt 0 ]
then 
  tail -50 $WORKSPACE/TestSetup/setup.log | grep Exception
  exit 1
else
    echo "Thank you, you can browse to http://localhost/$INSTANCE_NAME and login with admin / admin, and you should be able to execute the integration tests now..."
    
fi


{'fraction_non_alphanumeric': 0.1153979840111227, 'fraction_numerical': 0.011470281543274244, 'mean_word_length': 4.379439252336448, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4108774', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1050, 'n_words': 286}