diff --git a/.travis-ci.sh b/.travis-ci.sh index 2d24f3ce..b2cefd03 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -127,8 +127,22 @@ function build_onedrive { } function test_onedrive { - # Testing onedrive client + # Testing onedrive client - does the built application execute? ./onedrive --version + + # Functional testing on x64 only + if [ "${ARCH}" = "x64" ]; then + chmod a+x ./tests/makefiles.sh + cd ./tests/ + ./makefiles.sh + cd .. + mkdir -p ~/.config/onedrive/ + echo $ODP > ~/.config/onedrive/refresh_token + ./onedrive --synchronize --verbose --syncdir=~/OneDriveALT + # OneDrive Cleanup + rm -rf ~/OneDriveALT/* + ./onedrive --synchronize --verbose --syncdir=~/OneDriveALT + fi } if [ "${ARCH}" = "arm32" ] || [ "${ARCH}" = "arm64" ] || [ "${ARCH}" = "x32" ]; then diff --git a/tests/bad-file-name.tar.xz b/tests/bad-file-name.tar.xz new file mode 100644 index 00000000..6092add7 Binary files /dev/null and b/tests/bad-file-name.tar.xz differ diff --git a/tests/makefiles.sh b/tests/makefiles.sh new file mode 100644 index 00000000..16750d92 --- /dev/null +++ b/tests/makefiles.sh @@ -0,0 +1,60 @@ +ONEDRIVEALT=~/OneDriveALT +if [ ! -d ${ONEDRIVEALT} ]; then + mkdir -p ${ONEDRIVEALT} +else + rm -rf ${ONEDRIVEALT}/* +fi + +BADFILES=${ONEDRIVEALT}/bad_files +TESTFILES=${ONEDRIVEALT}/test_files +mkdir -p ${BADFILES} +mkdir -p ${TESTFILES} +dd if=/dev/urandom of=${TESTFILES}/large_file1.txt count=15 bs=1572864 +dd if=/dev/urandom of=${TESTFILES}/large_file2.txt count=20 bs=1572864 + +# Create bad files that should be skipped +touch "${BADFILES}/ leading_white_space" +touch "${BADFILES}/trailing_white_space " +touch "${BADFILES}/trailing_dot." +touch "${BADFILES}/includes < in the filename" +touch "${BADFILES}/includes > in the filename" +touch "${BADFILES}/includes : in the filename" +touch "${BADFILES}/includes \" in the filename" +touch "${BADFILES}/includes | in the filename" +touch "${BADFILES}/includes ? in the filename" +touch "${BADFILES}/includes * in the filename" +touch "${BADFILES}/includes \\ in the filename" +touch "${BADFILES}/includes \\\\ in the filename" +touch "${BADFILES}/CON" +touch "${BADFILES}/CON.text" +touch "${BADFILES}/PRN" +touch "${BADFILES}/AUX" +touch "${BADFILES}/NUL" +touch "${BADFILES}/COM0" +touch "${BADFILES}/COM1" +touch "${BADFILES}/COM2" +touch "${BADFILES}/COM3" +touch "${BADFILES}/COM4" +touch "${BADFILES}/COM5" +touch "${BADFILES}/COM6" +touch "${BADFILES}/COM7" +touch "${BADFILES}/COM8" +touch "${BADFILES}/COM9" +touch "${BADFILES}/LPT0" +touch "${BADFILES}/LPT1" +touch "${BADFILES}/LPT2" +touch "${BADFILES}/LPT3" +touch "${BADFILES}/LPT4" +touch "${BADFILES}/LPT5" +touch "${BADFILES}/LPT6" +touch "${BADFILES}/LPT7" +touch "${BADFILES}/LPT8" +touch "${BADFILES}/LPT9" + +# Test files from cases +# File contains invalid whitespace characters +tar xf ./bad-file-name.tar.xz -C ${BADFILES}/ + +# HelloCOM2.rar should be allowed +dd if=/dev/urandom of=${TESTFILES}/HelloCOM2.rar count=5 bs=1572864 +