From 02481bf5d52b2b118aec1e7f85540f5a8de02bdd Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Fri, 25 Oct 2024 15:57:00 +1000 Subject: [PATCH] tests: Copy a file over to the share before reading it back. Remove the dependency that a file callet CAT must pre-exist on the share when running the tests. Signed-off-by: Ronnie Sahlberg --- tests/test_0201_mkdir_valgrind.sh | 15 +++++++++++++++ tests/test_0300_cat_basic.sh | 3 +-- tests/test_0301_cat_valgrind.sh | 3 +-- tests/test_0302_cat_valgrind_socket_error.sh | 3 +-- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100755 tests/test_0201_mkdir_valgrind.sh diff --git a/tests/test_0201_mkdir_valgrind.sh b/tests/test_0201_mkdir_valgrind.sh new file mode 100755 index 00000000..d7d481e0 --- /dev/null +++ b/tests/test_0201_mkdir_valgrind.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. ./functions.sh + +echo "mkdir test with valgrind" + +echo -n "Testing mkdir on root of share ... " +libtool --mode=execute valgrind --leak-check=full --error-exitcode=1 ./prog_mkdir "${TESTURL}/testdir" >/dev/null 2>&1 || failure +success + +echo -n "Testing rmdir on root of share ... " +libtool --mode=execute valgrind --leak-check=full --error-exitcode=1 ./prog_rmdir "${TESTURL}/testdir" >/dev/null 2>&1 || failure +success + +exit 0 diff --git a/tests/test_0300_cat_basic.sh b/tests/test_0300_cat_basic.sh index f401c66e..bbc46bf6 100755 --- a/tests/test_0300_cat_basic.sh +++ b/tests/test_0300_cat_basic.sh @@ -4,8 +4,7 @@ echo "basic cat test" -# This test depends on the file CAT existing on the share used for testing -# TODO: should create the file first +../utils/smb2-cp ./prog_cat.c "${TESTURL}/CAT" echo -n "Testing prog_cat on root of share/CAT ... " ./prog_cat "${TESTURL}/CAT" > /dev/null || failure diff --git a/tests/test_0301_cat_valgrind.sh b/tests/test_0301_cat_valgrind.sh index 6b201118..27d6fcf5 100755 --- a/tests/test_0301_cat_valgrind.sh +++ b/tests/test_0301_cat_valgrind.sh @@ -4,8 +4,7 @@ echo "basic cat test with valgrind" -# This test depends on the file CAT existing on the share used for testing -# TODO: should create the file first +../utils/smb2-cp ./prog_cat.c "${TESTURL}/CAT" echo -n "Testing prog_cat on root of share/CAT ... " libtool --mode=execute valgrind --leak-check=full --error-exitcode=1 ./prog_cat "${TESTURL}/CAT" >/dev/null 2>&1 || failure diff --git a/tests/test_0302_cat_valgrind_socket_error.sh b/tests/test_0302_cat_valgrind_socket_error.sh index def4d022..ba7e1d0b 100755 --- a/tests/test_0302_cat_valgrind_socket_error.sh +++ b/tests/test_0302_cat_valgrind_socket_error.sh @@ -4,8 +4,7 @@ echo "basic cat test with valgrind and session errors" -# This test depends on the file CAT existing on the share used for testing -# TODO: should create the file first +../utils/smb2-cp ./prog_cat.c "${TESTURL}/CAT" NUM_CALLS=`libtool --mode=execute strace ./prog_cat "${TESTURL}/CAT" 2>&1 >/dev/null | grep readv |wc -l`