diff --git a/tests/cases/100_volume/050_flock_volume/check_flock.sh b/tests/cases/100_volume/050_flock_volume/check_flock.sh new file mode 100644 index 0000000..ee73bc7 --- /dev/null +++ b/tests/cases/100_volume/050_flock_volume/check_flock.sh @@ -0,0 +1,28 @@ +#! /bin/sh + +set -e +set -x + +FILE=$1 +ret=0 + +# First check that flock works +flock -x "$FILE" echo "flock works" + +# disable exit on error as we expect an error below +set +e + +# start a background process locking a file +flock -x "$FILE" sleep 1000 & +pid=$! + +# try to lock the file +flock -xn "$FILE" echo "locked although locked" +res=$? +[ $res -eq 0 ] && $ret = 1 # If we did not get an error this test failed + +# clean up +kill $pid +flock -u "$FILE" echo "unlocked" + +exit $ret diff --git a/tests/cases/100_volume/050_flock_volume/test.ps1 b/tests/cases/100_volume/050_flock_volume/test.ps1 new file mode 100644 index 0000000..90844e7 --- /dev/null +++ b/tests/cases/100_volume/050_flock_volume/test.ps1 @@ -0,0 +1,27 @@ +# SUMMARY: Check that flock() works on a shared volume +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +$fileName = "lockfile" +$testPath = Join-Path -Path $env:TEST_TMP -ChildPath $fileName + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +New-Item -ItemType Directory -Force -Path $env:TEST_TMP + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $env:TEST_TMP`:/test ` + -v $p`:/script ` + -e TZ=UTC alpine:3.7 sh /script/check_flock.sh /test/$fileName +if ($lastexitcode -ne 0) { + $ret = 1 +} + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +exit $ret diff --git a/tests/cases/100_volume/052_flock_volume_containers/check_flock.sh b/tests/cases/100_volume/052_flock_volume_containers/check_flock.sh new file mode 100644 index 0000000..79d9fb0 --- /dev/null +++ b/tests/cases/100_volume/052_flock_volume_containers/check_flock.sh @@ -0,0 +1,21 @@ +#! /bin/sh + +set -x + +FILE=$1 +ret=0 + +# start a background process locking a file +flock -x "$FILE" sleep 1000 & +pid=$! + +# try to lock the file +flock -xn "$FILE" echo "locked although locked" +res=$? +[ $res -eq 0 ] && $ret = 1 # If we did not get an error this test failed + +# clean up +kill $pid +flock -u "$FILE" echo "unlocked" + +exit $ret diff --git a/tests/cases/100_volume/052_flock_volume_containers/test.ps1 b/tests/cases/100_volume/052_flock_volume_containers/test.ps1 new file mode 100644 index 0000000..d290709 --- /dev/null +++ b/tests/cases/100_volume/052_flock_volume_containers/test.ps1 @@ -0,0 +1,41 @@ +# SUMMARY: Check that flock() works between containers sharing the same volume +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +$fileName = "lockfile" +$testPath = Join-Path -Path $env:TEST_TMP -ChildPath $fileName +$containerName = $env:RT_TEST_NAME + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +New-Item -ItemType Directory -Force -Path $env:TEST_TMP + +# Check that flock works first +docker run --platform linux --rm --name $containerName -v $env:TEST_TMP`:/test alpine:3.7 ` + flock -x /test/$fileName echo "flock works" +if ($lastexitcode -ne 0) { + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP + exit 1 +} + +# Start a container in the background which locks the file +docker run --platform linux --rm -d --name $containerName -v $env:TEST_TMP`:/test alpine:3.7 ` + flock -x /test/$fileName sleep 1000 + +# Start another container trying to lock the same file. This should fail +docker run --platform linux --rm -v $env:TEST_TMP`:/test alpine:3.7 ` + flock -xn /test/$fileName echo "locked although locked" +if ($lastexitcode -eq 0) { + $ret = 1 +} + +# remove the background container +docker kill $containerName + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +exit $ret diff --git a/tests/cases/100_volume/150_utime/test.ps1 b/tests/cases/100_volume/150_utime/test.ps1 index f0216b7..7a2bc16 100644 --- a/tests/cases/100_volume/150_utime/test.ps1 +++ b/tests/cases/100_volume/150_utime/test.ps1 @@ -17,7 +17,7 @@ New-Item -ItemType Directory -Force -Path $env:TEST_TMP # # Create a file in a container and check on the host # -docker run --rm -v $env:TEST_TMP`:/test -e TZ=UTC alpine touch -t 197002010000.00 /test/$fileName +docker run --rm -v $env:TEST_TMP`:/test -e TZ=UTC alpine:3.7 touch -t 197002010000.00 /test/$fileName # check timestamp $expected = Get-Date -Date "1970-02-01 00:00:00Z" @@ -41,7 +41,7 @@ $p = [string]$pwd.Path docker run --platform linux --rm ` -v $env:TEST_TMP`:/test ` -v $p`:/script ` - -e TZ=UTC alpine sh /script/check_time.sh /test/$fileName + -e TZ=UTC alpine:3.7 sh /script/check_time.sh /test/$fileName if ($lastexitcode -ne 0) { $ret = 1 } diff --git a/tests/cases/900_perf/100_volume/010_dd_200MB_1KB_blocks/test.ps1 b/tests/cases/900_perf/100_volume/010_dd/010_200MB_1KB_blocks/test.ps1 similarity index 100% rename from tests/cases/900_perf/100_volume/010_dd_200MB_1KB_blocks/test.ps1 rename to tests/cases/900_perf/100_volume/010_dd/010_200MB_1KB_blocks/test.ps1 diff --git a/tests/cases/900_perf/100_volume/012_dd_200MB_4KB_blocks/test.ps1 b/tests/cases/900_perf/100_volume/010_dd/012_200MB_4KB_blocks/test.ps1 similarity index 100% rename from tests/cases/900_perf/100_volume/012_dd_200MB_4KB_blocks/test.ps1 rename to tests/cases/900_perf/100_volume/010_dd/012_200MB_4KB_blocks/test.ps1 diff --git a/tests/cases/900_perf/100_volume/014_dd_200MB_16KB_blocks/test.ps1 b/tests/cases/900_perf/100_volume/010_dd/014_200MB_16KB_blocks/test.ps1 similarity index 100% rename from tests/cases/900_perf/100_volume/014_dd_200MB_16KB_blocks/test.ps1 rename to tests/cases/900_perf/100_volume/010_dd/014_200MB_16KB_blocks/test.ps1 diff --git a/tests/cases/900_perf/100_volume/016_dd_200MB_64KB_blocks/test.ps1 b/tests/cases/900_perf/100_volume/010_dd/016_200MB_64KB_blocks/test.ps1 similarity index 100% rename from tests/cases/900_perf/100_volume/016_dd_200MB_64KB_blocks/test.ps1 rename to tests/cases/900_perf/100_volume/010_dd/016_200MB_64KB_blocks/test.ps1 diff --git a/tests/cases/900_perf/100_volume/018_dd_200MB_1MB_blocks/test.ps1 b/tests/cases/900_perf/100_volume/010_dd/018_200MB_1MB_blocks/test.ps1 similarity index 100% rename from tests/cases/900_perf/100_volume/018_dd_200MB_1MB_blocks/test.ps1 rename to tests/cases/900_perf/100_volume/010_dd/018_200MB_1MB_blocks/test.ps1 diff --git a/tests/cases/900_perf/100_volume/020_dd_100MB_4KB_blocks_parallel/dd_5_parallel.sh b/tests/cases/900_perf/100_volume/010_dd/020_100MB_4KB_blocks_parallel/dd_5_parallel.sh similarity index 100% rename from tests/cases/900_perf/100_volume/020_dd_100MB_4KB_blocks_parallel/dd_5_parallel.sh rename to tests/cases/900_perf/100_volume/010_dd/020_100MB_4KB_blocks_parallel/dd_5_parallel.sh diff --git a/tests/cases/900_perf/100_volume/020_dd_100MB_4KB_blocks_parallel/test.ps1 b/tests/cases/900_perf/100_volume/010_dd/020_100MB_4KB_blocks_parallel/test.ps1 similarity index 100% rename from tests/cases/900_perf/100_volume/020_dd_100MB_4KB_blocks_parallel/test.ps1 rename to tests/cases/900_perf/100_volume/010_dd/020_100MB_4KB_blocks_parallel/test.ps1 diff --git a/tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/run.sh new file mode 100644 index 0000000..2035559 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/run.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +set -e +# don't set -x as it creates a lot of noise + +DIR=$1 + +# find calls lstat() +find "$DIR" -type f > dev/null diff --git a/tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/test.ps1 new file mode 100644 index 0000000..ed50d39 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/test.ps1 @@ -0,0 +1,22 @@ +# SUMMARY: Stat 5000 files in a single directory created on the host +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-stat" + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $testPath`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/run.sh new file mode 100644 index 0000000..322c846 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/run.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +# set -e +# don't set -x as it creates a lot of noise + +DIR=$1 + +for i in $(seq 5000); do + stat "$DIR/file-$i" 2> /dev/null +done +exit 0 diff --git a/tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/test.ps1 new file mode 100644 index 0000000..067dc00 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/test.ps1 @@ -0,0 +1,24 @@ +# SUMMARY: Stat 5000 non-existing files in a single directory on a shared volume +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +New-Item -ItemType Directory -Force -Path $env:TEST_TMP + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $env:TEST_TMP`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/run.sh new file mode 100644 index 0000000..9763b85 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/run.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +set -e +# don't set -x as it creates a lot of noise + +DIR=$1 + +for i in $(seq 5000); do + touch "$DIR/file-$i" +done diff --git a/tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/test.ps1 new file mode 100644 index 0000000..e5647da --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/test.ps1 @@ -0,0 +1,24 @@ +# SUMMARY: Create 5000 files in a single directory on a shared volume +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +New-Item -ItemType Directory -Force -Path $env:TEST_TMP + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $env:TEST_TMP`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/run.sh new file mode 100644 index 0000000..486a949 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/run.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e +# don't set -x as it creates a lot of noise + +DIR=$1 + +for i in $(seq 5000); do + touch "$DIR/file-$i" +done + +# find calls lstat() +find "$DIR" -type f > dev/null diff --git a/tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/test.ps1 new file mode 100644 index 0000000..2759102 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/test.ps1 @@ -0,0 +1,24 @@ +# SUMMARY: Create 5000 files in a single directory on a shared volume and then stat them +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +New-Item -ItemType Directory -Force -Path $env:TEST_TMP + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $env:TEST_TMP`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/run.sh new file mode 100644 index 0000000..6b4078a --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/run.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +set -e +# don't set -x as it creates a lot of noise + +DIR=$1 + +# find calls lstat() +find "$DIR" -type f -print0 | xargs -0 touch > dev/null diff --git a/tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/test.ps1 new file mode 100644 index 0000000..ff64573 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/test.ps1 @@ -0,0 +1,22 @@ +# SUMMARY: Stat and then touch 5000 files in a single directory created on the host +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-touch" + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $testPath`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/run.sh new file mode 100644 index 0000000..e23b263 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/run.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +set -e + +DIR=$1 + +# find calls lstat() +find "$DIR" -type f -print0 | xargs -0 touch > dev/null +find "$DIR" -type f > dev/null diff --git a/tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/test.ps1 new file mode 100644 index 0000000..33a0452 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/test.ps1 @@ -0,0 +1,22 @@ +# SUMMARY: Stat, touch and then stat again 5000 files on a shared volume +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-touch-stat" + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $testPath`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/run.sh new file mode 100644 index 0000000..d23a3f5 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/run.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +set -e + +DIR=$1 +SIZE=$2 + +for i in $(seq 5000); do + dd if=/dev/zero of="$DIR/file-$i" bs="$SIZE" count=1 +done diff --git a/tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/test.ps1 new file mode 100644 index 0000000..4b03436 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/test.ps1 @@ -0,0 +1,24 @@ +# SUMMARY: Write 5000 small files in a single directory +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +New-Item -ItemType Directory -Force -Path $env:TEST_TMP + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $env:TEST_TMP`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test 512 +if ($lastexitcode -ne 0) { + $ret = 1 +} + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/065_write_write_5000_files_512B/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/065_write_write_5000_files_512B/run.sh new file mode 100644 index 0000000..3d4de1e --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/065_write_write_5000_files_512B/run.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +set -e + +DIR=$1 +SIZE=$2 + +for i in $(seq 5000); do + dd if=/dev/zero of="$DIR/file-$i" bs="$SIZE" count=1 +done + +for i in $(seq 5000); do + dd if=/dev/zero of="$DIR/file-$i" bs="$SIZE" count=1 +done diff --git a/tests/cases/900_perf/100_volume/020_single_dir/065_write_write_5000_files_512B/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/065_write_write_5000_files_512B/test.ps1 new file mode 100644 index 0000000..f81f564 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/065_write_write_5000_files_512B/test.ps1 @@ -0,0 +1,24 @@ +# SUMMARY: Write twice over the 5000 small files in a single directory +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +New-Item -ItemType Directory -Force -Path $env:TEST_TMP + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $env:TEST_TMP`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test 512 +if ($lastexitcode -ne 0) { + $ret = 1 +} + +Remove-Item -Force -Recurse -ErrorAction Ignore -Path $env:TEST_TMP +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/070_stat_read_5000_files_512B/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/070_stat_read_5000_files_512B/run.sh new file mode 100644 index 0000000..0cc9af1 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/070_stat_read_5000_files_512B/run.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +set -e +# don't set -x as it creates a lot of noise + +DIR=$1 + +# find calls lstat() +find "$DIR" -type f -print0 | xargs -0 cat > dev/null diff --git a/tests/cases/900_perf/100_volume/020_single_dir/070_stat_read_5000_files_512B/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/070_stat_read_5000_files_512B/test.ps1 new file mode 100644 index 0000000..a2568a8 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/070_stat_read_5000_files_512B/test.ps1 @@ -0,0 +1,22 @@ +# SUMMARY: Stat and then read 5000 files in a single directory created on the host +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-read" + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $testPath`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/075_stat_read_stat_read_5000_files_512B/run.sh b/tests/cases/900_perf/100_volume/020_single_dir/075_stat_read_stat_read_5000_files_512B/run.sh new file mode 100644 index 0000000..d44193f --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/075_stat_read_stat_read_5000_files_512B/run.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +set -e + +DIR=$1 + +# find calls lstat() +find "$DIR" -type f -print0 | xargs -0 cat > dev/null +find "$DIR" -type f -print0 | xargs -0 cat > dev/null diff --git a/tests/cases/900_perf/100_volume/020_single_dir/075_stat_read_stat_read_5000_files_512B/test.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/075_stat_read_stat_read_5000_files_512B/test.ps1 new file mode 100644 index 0000000..42a3264 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/075_stat_read_stat_read_5000_files_512B/test.ps1 @@ -0,0 +1,22 @@ +# SUMMARY: Stat, read, stat, read 5000 files in a single directory created on the host +# LABELS: +# REPEAT: + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$ret = 0 + +$testPath = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-read-read" + +$p = [string]$pwd.Path +docker run --platform linux --rm ` + -v $testPath`:/test ` + -v $p`:/script ` + alpine:3.7 sh /script/run.sh /test +if ($lastexitcode -ne 0) { + $ret = 1 +} + +exit $ret diff --git a/tests/cases/900_perf/100_volume/020_single_dir/group.ps1 b/tests/cases/900_perf/100_volume/020_single_dir/group.ps1 new file mode 100644 index 0000000..25983a0 --- /dev/null +++ b/tests/cases/900_perf/100_volume/020_single_dir/group.ps1 @@ -0,0 +1,94 @@ +# create some test directories here so they are not part of the test + +$libBase = Join-Path -Path $env:RT_PROJECT_ROOT -ChildPath _lib +$lib = Join-Path -Path $libBase -ChildPath lib.ps1 +. $lib + +$res = 0 + +# these need to be kept in sync with the respective test +$singleDirStat = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-stat" +$singleDirTouch = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-touch" +$singleDirTouchStat = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-touch-stat" +$singleDirRead = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-read" +$singleDirReadRead = Join-Path -Path $env:TEST_TMP_ROOT -ChildPath "single-dir-read-read" + +function GroupInit([REF]$res) { + # Create files for stat testing + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirStat + New-Item -ItemType Directory -Force -Path $singleDirStat + $i = 0 + While ($i -lt 5000) { + $fileName = "file-" + $i + $filePath = Join-Path -Path $singleDirStat -ChildPath $fileName + New-Item -ItemType File -Path $filePath + $i += 1 + } + + # Create files for touch testing + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirTouch + New-Item -ItemType Directory -Force -Path $singleDirTouch + $i = 0 + While ($i -lt 5000) { + $fileName = "file-" + $i + $filePath = Join-Path -Path $singleDirTouch -ChildPath $fileName + New-Item -ItemType File -Path $filePath + $i += 1 + } + + # Create files for touch + stat testing + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirTouchStat + New-Item -ItemType Directory -Force -Path $singleDirTouchStat + $i = 0 + While ($i -lt 5000) { + $fileName = "file-" + $i + $filePath = Join-Path -Path $singleDirTouchStat -ChildPath $fileName + New-Item -ItemType File -Path $filePath + $i += 1 + } + + # Create files for a read test + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirRead + New-Item -ItemType Directory -Force -Path $singleDirRead + $i = 0 + While ($i -lt 5000) { + $fileName = "file-" + $i + $filePath = Join-Path -Path $singleDirRead -ChildPath $fileName + $f = new-object System.IO.FileStream $fileName, Create, ReadWrite + $f.SetLength(512) + $f.Close() + $i += 1 + } + + # Create files for a read read test + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirReadRead + New-Item -ItemType Directory -Force -Path $singleDirReadRead + $i = 0 + While ($i -lt 5000) { + $fileName = "file-" + $i + $filePath = Join-Path -Path $singleDirReadRead -ChildPath $fileName + $f = new-object System.IO.FileStream $fileName, Create, ReadWrite + $f.SetLength(512) + $f.Close() + $i += 1 + } + + $res.Value = 0 +} + +function GroupDeinit([REF]$res) { + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirStat + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirTouch + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirTouchStat + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirRead + Remove-Item -Force -Recurse -ErrorAction Ignore -Path $singleDirReadRead + $res.Value = 0 +} + +$CMD=$args[0] +Switch ($CMD) { + 'init' { GroupInit([REF]$res) } + 'deinit' { GroupDeinit([REF]$res) } +} + +exit $res