version: Update version test
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
e2fd4773da
commit
3359cbae6f
1
config
1
config
|
@ -24,6 +24,7 @@ Export("env", "use_package", "CONFIG_DEBUG", "CONFIG_VERSION")
|
|||
|
||||
|
||||
include = SConscript("include/Sconscript")
|
||||
|
||||
lib = SConscript("lib/Sconscript")
|
||||
|
||||
tests = SConscript("tests/Sconscript")
|
||||
|
|
|
@ -2,10 +2,20 @@
|
|||
Import("env")
|
||||
|
||||
src = SConscript("src/Sconscript")
|
||||
test = Command("tests.out", [], "./tests/test")
|
||||
|
||||
AlwaysBuild(test)
|
||||
Depends(test, src)
|
||||
tests = [ "version" ]
|
||||
|
||||
|
||||
def Test(name):
|
||||
return Command("%s.out" % name, [], "./tests/%s" % name)
|
||||
|
||||
for test in tests:
|
||||
t = Test(test)
|
||||
Depends(t, src)
|
||||
AlwaysBuild(t)
|
||||
|
||||
#AlwaysBuild(test)
|
||||
#Depends(test, src)
|
||||
|
||||
#scripts = [ "print", "file", "database", "index", "filter", "idle", "playlist",
|
||||
# "library", "playqueue", "deck", "audio", "gui" ]
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2014 (c) Anna Schumaker
|
||||
|
||||
function read_config
|
||||
{
|
||||
cat ../config | grep ^$1 | awk -F= '{print $2}' | tr -d ' '
|
||||
}
|
||||
|
||||
function config_version
|
||||
{
|
||||
read_config CONFIG_VERSION
|
||||
}
|
||||
|
||||
function config_debug
|
||||
{
|
||||
read_config CONFIG_DEBUG
|
||||
}
|
||||
|
||||
function test_success
|
||||
{
|
||||
echo "Success!"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function test_failed
|
||||
{
|
||||
echo "FAILED =("
|
||||
on_failed
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd $(dirname $0)
|
||||
echo -n "Testing $(basename $0) ... "
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) Anna Schumaker.
|
||||
|
||||
VERSION=$(cat ../config | grep ^CONFIG_VERSION | awk -F= '{print $2}' | tr -d ' ')
|
||||
DEBUG=$(cat ../config | grep ^CONFIG_DEBUG | awk -F= '{print $2}' | tr -d ' ')
|
||||
|
||||
function utility
|
||||
{
|
||||
echo src/$1
|
||||
}
|
||||
|
||||
echo -n "Running test '$1' ... "
|
||||
. tests/$1
|
10
tests/test
10
tests/test
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2014 (c) Anna Schumaker.
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
[ $? == 0 ] && tests=$(ls tests/) || tests="$*"
|
||||
|
||||
for t in $tests; do
|
||||
./run_test $t
|
||||
done
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2014 (c) Anna Schumaker.
|
||||
|
||||
expected=$VERSION
|
||||
[ $DEBUG == "True" ] && expected="$expected-debug"
|
||||
|
||||
cmd=$(utility version)
|
||||
actual=$($cmd)
|
||||
|
||||
if [ $expected == $actual ]; then
|
||||
echo "Success!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "FAILED =("
|
||||
echo "Expected output: $expected"
|
||||
echo "Actual output: $actual"
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2014 (c) Anna Schumaker.
|
||||
|
||||
. $(dirname $0)/_functions
|
||||
|
||||
|
||||
# Find version
|
||||
version=$(config_version)
|
||||
[ $(config_debug) == "True" ] && version="$version-debug"
|
||||
|
||||
|
||||
# Run test
|
||||
out=$(./src/version)
|
||||
|
||||
|
||||
# Analyze result
|
||||
[ "$version" == "$out" ] && test_success
|
||||
|
||||
function on_failed
|
||||
{
|
||||
echo " Expected version: $version"
|
||||
echo " Actual version: $out"
|
||||
}
|
||||
test_failed
|
Loading…
Reference in New Issue