80 lines
1.9 KiB
Bash
80 lines
1.9 KiB
Bash
#!/bin/bash
|
|
#
|
|
# May 2005, M. Spiekermann
|
|
#
|
|
# Create databases opt and TPC_H in a temporary
|
|
# directory and run some queries. If the optimizer
|
|
# creates plans and executes them successfully
|
|
# "everything" might be ok. This is only a simple
|
|
# check but better than nothing.
|
|
#
|
|
|
|
libFile="libutil.sh"
|
|
#include libutil.sh if present
|
|
buildDir=${SECONDO_BUILD_DIR}
|
|
scriptDir="."
|
|
if [ -z $buildDir ]; then
|
|
printf "%s\n" "Error: I can't find file ${libUtil}."
|
|
exit 1
|
|
else
|
|
scriptDir=${buildDir}/CM-Scripts
|
|
fi
|
|
|
|
source ${scriptDir}/$libFile
|
|
if [ $? -ne 0 ]; then exit 1; fi
|
|
|
|
# default options
|
|
scaleFactor="0.01"
|
|
if [ "$1" != "" ]; then
|
|
scaleFactor=$1
|
|
fi
|
|
|
|
# define some directories and variables
|
|
|
|
tempDir="/tmp/$USER/TestOptimizer/${date_ymd}_${date_HMS}"
|
|
mkdir -p $tempDir
|
|
export SECONDO_PARAM_SecondoHome=$tempDir
|
|
|
|
export SECONDO_CONFIG=$buildDir/bin/SecondoConfig.ini
|
|
|
|
|
|
declare -i error=0
|
|
logFile="${PWD}/TestOptimizer.log"
|
|
|
|
TPC_GEN_DIR=${SECONDO_BUILD_DIR}/Tools/Generators/TPC-H
|
|
TPC_SCRIPTS="$TPC_GEN_DIR/secondo"
|
|
#cd $TPC_SCRIPTS
|
|
|
|
export PATH=".:${PATH}:${TPC_SCRIPTS}"
|
|
|
|
printf "%s\n" "Logfile: $logFile"
|
|
|
|
# create databases
|
|
checkCmd "tpcgen.sh -s ${scaleFactor} -b ${tempDir} >> ${logFile} 2>&1"
|
|
if [ $? -ne 0 ]; then
|
|
exit 1
|
|
printf "%s\n" "Generation of TPC-H data failed!"
|
|
fi
|
|
checkCmd "ttyrun.sh 'create database opt;' >> ${logFile} 2>&1"
|
|
checkCmd "ttyrun.sh 'restore database opt from opt;' >> ${logFile} 2>&1"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
printf "%s\n" "Creation of test databases failed!"
|
|
exit 1
|
|
fi
|
|
|
|
# test optimizer
|
|
checkCmd "plrun.sh 'setOption(autoSamples), openOpt, runExamples2(N,0), halt(N).' >> ${logFile} 2>&1"
|
|
if [ $? -ne 0 ]; then
|
|
printf "%s\n" "Running optimizer examples failed!"
|
|
exit 2
|
|
fi
|
|
|
|
checkCmd "plrun.sh 'setOption(autoSamples), openTPC, runTPCExamples2(N,0), halt(N).' >> ${logFile} 2>&1"
|
|
if [ $? -ne 0 ]; then
|
|
printf "%s\n" "Running TPC-queries failed!"
|
|
exit 3
|
|
fi
|
|
|
|
rm -rf $tempDir
|