diff --git a/dev/tests/run_tests.sh b/dev/tests/run_tests.sh index 145870c..3e0b449 100755 --- a/dev/tests/run_tests.sh +++ b/dev/tests/run_tests.sh @@ -1,16 +1,22 @@ #!/usr/bin/env bash +#TODO: generalize _LOCAL_IS_REMOTE + + # Allows the following environment variables # TRAVIS_RUN=[true|false] # SSH_PORT=22 # SKIP_REMOTE=[true|false] +# See note about this variable in ofunctions +_LOCAL_IS_REMOTE=true + ## On Mac OSX, this needs to be run as root in order to use sudo without password ## From current terminal run sudo -s in order to get a new terminal as root ## On CYGWIN / MSYS, ACL and extended attributes aren't supported -# osync test suite 2018100801 +# osync test suite 2018101401 # 4 tests: # quicklocal @@ -209,8 +215,8 @@ function oneTimeSetUp () { readonly __confRemote=3 osyncParameters=() - #osyncParameters[$__quickLocal]="--initiator=$INITIATOR_DIR --target=$TARGET_DIR --instance-id=quicklocal" - #osyncParameters[$__confLocal]="$CONF_DIR/$LOCAL_CONF" + osyncParameters[$__quickLocal]="--initiator=$INITIATOR_DIR --target=$TARGET_DIR --instance-id=quicklocal" + osyncParameters[$__confLocal]="$CONF_DIR/$LOCAL_CONF" osyncDaemonParameters=() @@ -222,7 +228,7 @@ function oneTimeSetUp () { # Do not check remote config on msys or cygwin since we don't have a local SSH server if [ "$LOCAL_OS" != "msys" ] && [ "$LOCAL_OS" != "Cygwin" ] && [ $SKIP_REMOTE != true ]; then osyncParameters[$__quickRemote]="--initiator=$INITIATOR_DIR --target=ssh://localhost:$SSH_PORT/$TARGET_DIR --rsakey=${HOME}/.ssh/id_rsa_local --instance-id=quickremote --remote-token=SomeAlphaNumericToken9" - #osyncParameters[$__confRemote]="$CONF_DIR/$REMOTE_CONF" + osyncParameters[$__confRemote]="$CONF_DIR/$REMOTE_CONF" osyncDaemonParameters[$__remote]="$CONF_DIR/$REMOTE_CONF --on-changes" @@ -327,7 +333,7 @@ function test_Merge () { assertEquals "Install failed" "0" $? } -function nope_test_LargeFileSet () { +function test_LargeFileSet () { for i in "${osyncParameters[@]}"; do cd "$OSYNC_DIR" @@ -345,7 +351,7 @@ function nope_test_LargeFileSet () { done } -function nope_test_Exclusions () { +function test_Exclusions () { # Will sync except php files # RSYNC_EXCLUDE_PATTERN="*.php" is set at runtime for quicksync and in config files for other runs @@ -373,7 +379,7 @@ function nope_test_Exclusions () { done } -function nope_test_Deletetion () { +function test_Deletetion () { local iFile1="$INITIATOR_DIR/ific" local iFile2="$INITIATOR_DIR/ifoc" local tFile1="$TARGET_DIR/tfic" @@ -417,7 +423,7 @@ function nope_test_Deletetion () { done } -function nope_test_deletion_failure () { +function test_deletion_failure () { if [ "$LOCAL_OS" == "WinNT10" ] || [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "Cygwin" ]; then echo "Skipping deletion failure test as Win10 does not have chattr support." return 0 @@ -484,7 +490,7 @@ function nope_test_deletion_failure () { done } -function nope_test_skip_deletion () { +function test_skip_deletion () { local modes if [ "$OSYNC_MIN_VERSION" == "1" ]; then @@ -560,7 +566,7 @@ function nope_test_skip_deletion () { SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SKIP_DELETION" "" } -function nope_test_handle_symlinks () { +function test_handle_symlinks () { if [ "$OSYNC_MIN_VERSION" == "1" ]; then echo "Skipping symlink tests as osync v1.1x didn't handle this." return 0 @@ -741,7 +747,7 @@ function nope_test_handle_symlinks () { done } -function nope_test_softdeletion_cleanup () { +function test_softdeletion_cleanup () { #declare -A files files=() @@ -818,7 +824,7 @@ function nope_test_softdeletion_cleanup () { } -function nope_test_FileAttributePropagation () { +function test_FileAttributePropagation () { if [ "$TRAVIS_RUN" == true ]; then echo "Skipping FileAttributePropagation tests as travis does not support getfacl / setfacl." @@ -896,7 +902,7 @@ function nope_test_FileAttributePropagation () { done } -function nope_test_ConflictBackups () { +function test_ConflictBackups () { for i in "${osyncParameters[@]}"; do cd "$OSYNC_DIR" PrepareLocalDirs @@ -932,7 +938,7 @@ function nope_test_ConflictBackups () { done } -function nope_test_MultipleConflictBackups () { +function test_MultipleConflictBackups () { local additionalParameters @@ -994,7 +1000,7 @@ function nope_test_MultipleConflictBackups () { SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" "no" } -function nope_test_Locking () { +function test_Locking () { # local not running = resume # remote same instance_id = resume # remote different instance_id = stop @@ -1125,7 +1131,7 @@ function test_ConflictDetetion () { touch "$TARGET_DIR/$FileA" # Initializing treeList - SLEEP_TIME=.5 REMOTE_HOST_PING=$RHOST_PING _PARANOIA_DEBUG=no $OSYNC_EXECUTABLE $i --initialize > "$FAKEROOT/output1.log" 2>&1 + REMOTE_HOST_PING=$RHOST_PING _PARANOIA_DEBUG=no $OSYNC_EXECUTABLE $i --initialize > "$FAKEROOT/output1.log" 2>&1 cat "$FAKEROOT/output1.log" assertEquals "Initialization run with parameters [$i]." "0" $? @@ -1138,11 +1144,10 @@ function test_ConflictDetetion () { # Now run should return conflicts - SLEEP_TIME=.5 REMOTE_HOST_PING=$RHOST_PING _DEBUG=yes $OSYNC_EXECUTABLE $i --log-conflicts > "$FAKEROOT/output2.log" 2>&1 + _LOCAL_IS_REMOTE=true REMOTE_HOST_PING=$RHOST_PING $OSYNC_EXECUTABLE $i --log-conflicts > "$FAKEROOT/output2.log" 2>&1 result=$? assertEquals "Second run that should detect conflicts with parameters [$i]." "0" $result - #WIP cat "$FAKEROOT/output2.log" #WIP TODO change output.log from output2.log for debug reasons @@ -1156,7 +1161,7 @@ function test_ConflictDetetion () { done } -function nope_test_WaitForTaskCompletion () { +function test_WaitForTaskCompletion () { local pids # Tests compatible with v1.1 syntax @@ -1250,7 +1255,7 @@ function nope_test_WaitForTaskCompletion () { assertEquals "WaitForTaskCompletion test 5" "2" $? } -function nope_test_ParallelExec () { +function test_ParallelExec () { if [ "$OSYNC_MIN_VERSION" == "1" ]; then echo "Skipping ParallelExec test because osync v1.1 ofunctions don't have this function." return 0 @@ -1311,7 +1316,7 @@ function nope_test_ParallelExec () { assertNotEquals "ParallelExec full test 3" "0" $? } -function nope_test_timedExecution () { +function test_timedExecution () { local arguments local warnExitCode @@ -1358,7 +1363,7 @@ function nope_test_timedExecution () { done } -function nope_test_UpgradeConfRun () { +function test_UpgradeConfRun () { if [ "$OSYNC_MIN_VERSION" == "1" ]; then echo "Skipping Upgrade script test because no further dev will happen on this for v1.1" return 0 @@ -1384,7 +1389,7 @@ function nope_test_UpgradeConfRun () { rm -f "$CONF_DIR/$TMP_OLD_CONF.save" } -function nope_test_DaemonMode () { +function test_DaemonMode () { if [ "$LOCAL_OS" == "WinNT10" ] || [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "Cygwin" ]; then echo "Skipping daemon mode test as [$LOCAL_OS] does not have inotifywait support." return 0 @@ -1440,7 +1445,7 @@ function nope_test_DaemonMode () { } -function nope_test_NoRemoteAccessTest () { +function test_NoRemoteAccessTest () { RemoveSSH cd "$OSYNC_DIR"