This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from rn/moperf
More tests, in particular perf tests
- Loading branch information
Showing
33 changed files
with
546 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
21 changes: 21 additions & 0 deletions
21
tests/cases/100_volume/052_flock_volume_containers/check_flock.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
41 changes: 41 additions & 0 deletions
41
tests/cases/100_volume/052_flock_volume_containers/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
22 changes: 22 additions & 0 deletions
22
tests/cases/900_perf/100_volume/020_single_dir/010_stat_5000_files/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
11 changes: 11 additions & 0 deletions
11
tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
24 changes: 24 additions & 0 deletions
24
tests/cases/900_perf/100_volume/020_single_dir/015_stat_5000_non_existing_files/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
10 changes: 10 additions & 0 deletions
10
tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
24 changes: 24 additions & 0 deletions
24
tests/cases/900_perf/100_volume/020_single_dir/020_touch_5000_files/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
13 changes: 13 additions & 0 deletions
13
tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
24 changes: 24 additions & 0 deletions
24
tests/cases/900_perf/100_volume/020_single_dir/030_touch_stat_5000_files/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
9 changes: 9 additions & 0 deletions
9
tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
22 changes: 22 additions & 0 deletions
22
tests/cases/900_perf/100_volume/020_single_dir/040_stat_touch_5000_files/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
9 changes: 9 additions & 0 deletions
9
tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
22 changes: 22 additions & 0 deletions
22
tests/cases/900_perf/100_volume/020_single_dir/050_stat_touch_stat_5000_files/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
10 changes: 10 additions & 0 deletions
10
tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
24 changes: 24 additions & 0 deletions
24
tests/cases/900_perf/100_volume/020_single_dir/060_write_5000_files_512B/test.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.