1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-12 19:03:42 +01:00

Added ParallelExec function test

This commit is contained in:
deajan 2016-08-30 21:50:04 +02:00
parent e6be72f5a8
commit fbdd12dc72
2 changed files with 38 additions and 4 deletions

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash
## obackup test suite 2016083003
# Stupid and very basic tests v0.0000003-alpha-dev-pre-everything
## obackup basic tests suite 2016083004
OBACKUP_DIR="$(pwd)"
OBACKUP_DIR=${OBACKUP_DIR%%/dev*}
@ -299,4 +298,22 @@ function test_WaitForTaskCompletion () {
assertEquals "WaitForTaskCompletion test 5" "2" $?
}
function test_ParallelExec () {
# Test if parallelExec works correctly
cmd="sleep 10;sleep 10;sleep 10;sleep 10"
ParallelExec 4 "$cmd"
assertEquals "ParallelExec test 1" "0" $?
cmd="sleep 10;du /none;sleep 5"
ParallelExec 2 "$cmd"
assertEquals "ParallelExec test 2" "1" $?
cmd="sleep 19;du /none;sleep 10;du /none;sleep 4"
ParallelExec 3 "$cmd"
assertEquals "ParallelExec test 3" "2" $?
}
echo "$CURRENT_LOG"
. "$TESTS_DIR/shunit2/shunit2"

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash
## obackup test suite 2016083003
# Stupid and very basic tests v0.0000003-alpha-dev-pre-everything
## obackup basic tests suite 2016083004
OBACKUP_DIR="$(pwd)"
OBACKUP_DIR=${OBACKUP_DIR%%/dev*}
@ -205,4 +204,22 @@ function test_WaitForTaskCompletion () {
assertEquals "WaitForTaskCompletion test 5" "2" $?
}
function test_ParallelExec () {
# Test if parallelExec works correctly
cmd="sleep 10;sleep 10;sleep 10;sleep 10"
ParallelExec 4 "$cmd"
assertEquals "ParallelExec test 1" "0" $?
cmd="sleep 10;du /none;sleep 5"
ParallelExec 2 "$cmd"
assertEquals "ParallelExec test 2" "1" $?
cmd="sleep 19;du /none;sleep 10;du /none;sleep 4"
ParallelExec 3 "$cmd"
assertEquals "ParallelExec test 3" "2" $?
}
echo "$CURRENT_LOG"
. "$TESTS_DIR/shunit2/shunit2"