Commit 5bf9840e authored by Ramon Nou's avatar Ramon Nou
Browse files

Added concatenate test

parent 2dd9d3a9
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -139,7 +139,6 @@ test rm rmdir mkdir:
    - mkdir -p "${LOG_PATH}"
    - ${INSTALL_PATH}/bin/gkfs_daemon --mount /tmp/mountdir --root /tmp/root &
    - sleep 4
    - chmod a+x ${TESTS_BASH}/bash_testing.sh
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BASH}/bash_testing.sh /tmp/mountdir
  artifacts:
    paths:
@@ -151,8 +150,19 @@ test bash file creation:
    - mkdir -p "${LOG_PATH}"
    - ${INSTALL_PATH}/bin/gkfs_daemon --mount /tmp/mountdir --root /tmp/root &
    - sleep 4
    - chmod a+x ${TESTS_BASH}/bash_testing2.sh
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BASH}/bash_testing2.sh /tmp/mountdir
  artifacts:
    paths:
     - "${LOG_PATH}"

test bash testing concatenate
  stage: test
  script:
    - mkdir -p "${LOG_PATH}"
    - ${INSTALL_PATH}/bin/gkfs_daemon --mount /tmp/mountdir --root /tmp/root &
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BASH}/bash_testing_concatenate.sh /tmp/mountdir
  artifacts:
    paths:
     - "${LOG_PATH}"
+52 −0
Original line number Diff line number Diff line
#!/bin/bash
function has_substring() {
   [[ "$1" != "${2/$1/}" ]]
}

ROOT=${1}

echo Creating two large files in tmp

dd if=/dev/urandom of=/tmp/large_file_01 bs=1M count=4

dd if=/dev/urandom of=/tmp/large_file_02 bs=1M count=4

echo Copy files to gekko
cp /tmp/large_file_01 ${ROOT}/

cp /tmp/large_file_02 ${ROOT}/

stat ${ROOT}/large_file_01
retval=$?
if [ $retval -ne 0 ]; then
	echo "File is not copied"
	exit 1
fi
stat ${ROOT}/large_file_02

if [ $retval -ne 0]; then
	echo "File is not copied"
	exit 1
fi

echo Concatenating two gekko files
cat ${ROOT}/large_file_01 >> ${ROOT}/large_file_02

stat ${ROOT}/large_file_02

retval=$?
echo Stat should be 8M

if [ $retval -ne 0 ]; then
        exit 1
fi
stat=`stat ${ROOT}/large_file_02`

if has_substring ${stat} "8388608"
then
	echo All Ok
else
	echo Size not updated
	exit 1
fi
exit 0