tests de base
This commit is contained in:
parent
c3fd368253
commit
13c308a4f3
@ -1,4 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#prend en entrée un lien ssh vers un répertoire remote git vide prêt à être rempli
|
||||||
|
|
||||||
|
Help()
|
||||||
|
{
|
||||||
|
echo "
|
||||||
|
NAME
|
||||||
|
creation_repo.sh
|
||||||
|
SYNOPSIS
|
||||||
|
creation_repo.sh [SSH LINK to en empty remote git repository]
|
||||||
|
DESCRIPTION
|
||||||
|
This script is in writing.
|
||||||
|
It creates a git repository in the current directory, linked to a remote passed as argument. Everything is up-to-date between the remote and the local versions. The data stored is generated randomly in binary.
|
||||||
|
OPTIONS
|
||||||
|
-h prints the help. "
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts ":h" option; do
|
||||||
|
case $option in
|
||||||
|
h) # display Help
|
||||||
|
Help
|
||||||
|
exit;;
|
||||||
|
\?) # Invalid option
|
||||||
|
echo "Error: Invalid option"
|
||||||
|
exit;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
if [ -d performance_testing ]; then
|
if [ -d performance_testing ]; then
|
||||||
rm -rf performance_testing
|
rm -rf performance_testing
|
||||||
fi
|
fi
|
||||||
@ -13,9 +41,9 @@ git merge
|
|||||||
dd if=/dev/urandom of=sample0 bs=1M count=1
|
dd if=/dev/urandom of=sample0 bs=1M count=1
|
||||||
git add .
|
git add .
|
||||||
git commit -m"first 1M sample created"
|
git commit -m"first 1M sample created"
|
||||||
|
|
||||||
git push -u origin main
|
git push -u origin main
|
||||||
git tag start
|
git tag start
|
||||||
|
git push origin start
|
||||||
dd if=/dev/urandom of=sample1 bs=1M count=1
|
dd if=/dev/urandom of=sample1 bs=1M count=1
|
||||||
git add sample1
|
git add sample1
|
||||||
git commit -m"second 1M sample created"
|
git commit -m"second 1M sample created"
|
||||||
|
158
git_update.sh
158
git_update.sh
@ -1,105 +1,61 @@
|
|||||||
#!/bin/bash
|
## Testing of differeng cloning methods
|
||||||
# Clone un dépôt git au bon endroit
|
Our objective is to find the least-consuming method in terms of memory and bandwidth resources.
|
||||||
# Stocker un minimum de données (et donc nettoyer)
|
We are interested in cloning one specific state of the repository. We are not interested in its history or the possibility to change it from the server where it has been cloned. The first step is done by the script creation_repo.sh which creates an adequate repository to test on. The testing in itself is done by performance_tests.sh.
|
||||||
# Télécharger un minimum de données
|
|
||||||
# En cas de conflit donner raison au remote (on écrase les versions locales)
|
|
||||||
|
|
||||||
declare -A usage
|
## Creation of the test repository
|
||||||
declare -A varia
|
The script creation_repo.sh creates a performance_testing repository.
|
||||||
|
NAME
|
||||||
|
creation_repo.sh
|
||||||
|
SYNOPSIS
|
||||||
|
creation_repo.sh [SSH LINK to en empty remote git repository]
|
||||||
|
DESCRIPTION
|
||||||
|
This script is in writing.
|
||||||
|
It creates a git repository in the current directory, linked to a remote passed as argument. Everything is up-to-date between the remote and the local versions. The data stored is generated randomly in binary.
|
||||||
|
OPTIONS
|
||||||
|
-h prints the help.
|
||||||
|
|
||||||
summary="$0 [options] <repo>"
|
Here is a history of the commits:
|
||||||
|
### branch main
|
||||||
|
commit f665df376fa57880b5edfb85b156c7703601980e (tag: start)
|
||||||
|
sample0 1M created
|
||||||
|
commit a17812c13a69986c1103e0d06ff0a0b59a3a4a63
|
||||||
|
sample1 1M created
|
||||||
|
commit bd9d8e9421c3253abba47b9def480f1b2d595568
|
||||||
|
sample3 1M created
|
||||||
|
commit 0e599f3b47bf3200dc6e2734df0c6e655c0d8dde
|
||||||
|
sample4 5M created
|
||||||
|
commit effb3cab262e6e1e8242e524e1862b6f77d7ad38
|
||||||
|
sample4 5M deleted
|
||||||
|
### branch secondary
|
||||||
|
commit 643cdbbda81f4c4f26513b9d6ecca3d436e97040
|
||||||
|
sample0 1M created
|
||||||
|
commit b4bac1f2a2c1b4ab325751748b9496cccc65b082
|
||||||
|
sample1 1M created
|
||||||
|
commit e69695f08e79c160045b3319297597a9d8c9b513
|
||||||
|
sample2 500K created
|
||||||
|
|
||||||
usage[b]="Branch of git repo"
|
Which gives us the latest state:
|
||||||
varia[b]=branch
|
### branch main
|
||||||
branch=main
|
sample0 1M
|
||||||
|
sample1 1M
|
||||||
usage[t]="Tag of git repo"
|
sample3 1M
|
||||||
varia[t]=tag
|
### branch secondary
|
||||||
tag=
|
sample0 1M
|
||||||
|
sample1 1M
|
||||||
usage[d]="Destination of clone"
|
sample2 500K
|
||||||
varia[d]=dst
|
|
||||||
dst='.'
|
|
||||||
|
|
||||||
usage[i]="privkey used to ssh pull"
|
|
||||||
varia[i]=privkey
|
|
||||||
privkey=''
|
|
||||||
|
|
||||||
usage[N]="Clone to a Non-empty target. Existing files will be overwritten"
|
|
||||||
varia[N]=nonempty_target
|
|
||||||
nonempty_target=false
|
|
||||||
|
|
||||||
usage[K]="Remote host key file (known_hosts) for ssh connections"
|
|
||||||
varia[K]=hostkeyfile
|
|
||||||
hostkeyfile=''
|
|
||||||
|
|
||||||
usage[H]="Use real home dir"
|
|
||||||
varia[H]=use_home
|
|
||||||
use_home=false
|
|
||||||
|
|
||||||
|
|
||||||
. driglibash-args
|
|
||||||
|
|
||||||
|
|
||||||
# Some SSH options
|
|
||||||
ssh_opt='ssh'
|
|
||||||
if [ -n "$privkey" ] ; then
|
|
||||||
ssh_opt="$ssh_opt -i $privkey"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$hostkeyfile" ] ; then
|
|
||||||
ssh_opt="$ssh_opt -o 'UserKnownHostsFile $hostkeyfile'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
repo="$1"
|
|
||||||
if [ -z "$repo" ] ; then
|
|
||||||
die "$0: Empty repo given\n$summary"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! $use_home ] ; then
|
|
||||||
set -a
|
|
||||||
export HOME=/dev/null
|
|
||||||
set +a
|
|
||||||
fi
|
|
||||||
|
|
||||||
run mkdir -p "$dst"
|
|
||||||
run cd "$dst"
|
|
||||||
|
|
||||||
|
|
||||||
if [ -d .git ] ; then
|
|
||||||
|
|
||||||
# Compute git branch and tag
|
|
||||||
tagref=
|
|
||||||
if [ -n "$tag" ] ; then
|
|
||||||
tagref="tags/$tag"
|
|
||||||
fi
|
|
||||||
|
|
||||||
run git fetch origin "$branch" --tags
|
|
||||||
run git checkout --force $tagref -B "$branch"
|
|
||||||
run git reset --hard # TODO we can keep some files?
|
|
||||||
# Preserve existing files in some cases
|
|
||||||
if ! "$nonempty_target" ; then
|
|
||||||
git clean -qffdx
|
|
||||||
fi
|
|
||||||
run git submodule update --init --recursive --force --recommend-shallow
|
|
||||||
run git submodule foreach git fetch
|
|
||||||
run git submodule foreach git checkout --force HEAD
|
|
||||||
run git submodule foreach git reset --hard
|
|
||||||
run git submodule foreach git clean -fdx
|
|
||||||
else
|
|
||||||
clone_dst='.'
|
|
||||||
|
|
||||||
# To override an existing dir, we need to clone elsewhere first
|
|
||||||
if "$nonempty_target" ; then
|
|
||||||
clone_dst="$(mktemp -d)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
run git clone -b "$branch" --single-branch --recurse-submodules --shallow-submodules --depth 1 --config core.sshCommand="$ssh_opt" "$repo" "$clone_dst"
|
|
||||||
|
|
||||||
# To override an existing dir, we then move everything to that dir
|
|
||||||
if "$nonempty_target" ; then
|
|
||||||
run mv "$clone_dst/"{*,.*} .
|
|
||||||
run rmdir "$clone_dst"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
The script performance_tests.sh measures memory and bandwidth usage of different git cloning scenarii.
|
||||||
|
NAME
|
||||||
|
performance_tests.sh
|
||||||
|
SYNOPSIS
|
||||||
|
performance_tests.sh [SSH LINK to en empty remote git repository] [number]
|
||||||
|
OPTIONS
|
||||||
|
-a excutes all the tests.
|
||||||
|
-n [number] executes test [number]
|
||||||
|
-h prints the help.
|
||||||
|
DESCRIPTION
|
||||||
|
This script is in writing. It allows you to measure memory and bandwidth usage for different method of cloning on the remote repository given.
|
||||||
|
TEST0: classic cloning
|
||||||
|
TEST1: --single-branch
|
||||||
|
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
. driglibash-base
|
. driglibash-base
|
||||||
#prerequisite: creation_repo.sh has been run
|
#prerequisite: creation_repo.sh has been run
|
||||||
#remove the local copy
|
|
||||||
|
|
||||||
Help()
|
Help()
|
||||||
{
|
{
|
||||||
@ -28,7 +27,7 @@ test0(){
|
|||||||
bw0=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
bw0=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
||||||
echo "memory usage in a classic cloning : $mem0"
|
echo "memory usage in a classic cloning : $mem0"
|
||||||
echo "bandwidth usage : $bw0"
|
echo "bandwidth usage : $bw0"
|
||||||
run rm -rf performance_testing
|
#run rm -rf performance_testing
|
||||||
}
|
}
|
||||||
|
|
||||||
test1(){
|
test1(){
|
||||||
@ -40,6 +39,30 @@ test1(){
|
|||||||
echo "memory usage in a --single-branch cloning : $mem1"
|
echo "memory usage in a --single-branch cloning : $mem1"
|
||||||
echo "bandwidth usage : $bw1"
|
echo "bandwidth usage : $bw1"
|
||||||
run
|
run
|
||||||
|
#rm -rf performance_testing
|
||||||
|
}
|
||||||
|
|
||||||
|
test2(){
|
||||||
|
section TEST2
|
||||||
|
echo "TEST 2 : case of --depth=1 --no-single-branch"
|
||||||
|
git clone --progress --depth=1 --no-single-branch $1 2> cloning_text
|
||||||
|
mem2=$(du ./performance_testing | tail -n1 | tr -cd [:digit:])
|
||||||
|
bw2=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
||||||
|
echo "memory usage in a --depth=1 --no-single-branch cloning : $mem2"
|
||||||
|
echo "bandwidth usage : $bw2"
|
||||||
|
run
|
||||||
|
rm -rf performance_testing
|
||||||
|
}
|
||||||
|
|
||||||
|
test3(){
|
||||||
|
section TEST3
|
||||||
|
echo "TEST 3 : case of --depth=1 with single-branch (default))"
|
||||||
|
git clone --progress --single-branch --depth=1 $1 2> cloning_text
|
||||||
|
mem3=$(du ./performance_testing | tail -n1 | tr -cd [:digit:])
|
||||||
|
bw3=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
||||||
|
echo "memory usage in a --depth=1 with single-branch cloning : $mem3"
|
||||||
|
echo "bandwidth usage : $bw3"
|
||||||
|
run
|
||||||
rm -rf performance_testing
|
rm -rf performance_testing
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,12 +93,19 @@ fi
|
|||||||
if [ "$ALL_TESTS" = true ]; then
|
if [ "$ALL_TESTS" = true ]; then
|
||||||
test0 $REPO_LINK
|
test0 $REPO_LINK
|
||||||
test1 $REPO_LINK
|
test1 $REPO_LINK
|
||||||
|
test2 $REPO_LINK
|
||||||
|
test3 $REPO_LINK
|
||||||
|
|
||||||
elif [ -n "$TEST_NUM" ]; then
|
elif [ -n "$TEST_NUM" ]; then
|
||||||
case $TEST_NUM in
|
case $TEST_NUM in
|
||||||
0)
|
0)
|
||||||
test0 $REPO_LINK;;
|
test0 $REPO_LINK;;
|
||||||
1)
|
1)
|
||||||
test1 $REPO_LINK;;
|
test1 $REPO_LINK;;
|
||||||
|
2)
|
||||||
|
test2 $REPO_LINK;;
|
||||||
|
3)
|
||||||
|
test3 $REPO_LINK;;
|
||||||
*)
|
*)
|
||||||
echo "Error: Invalid test number"
|
echo "Error: Invalid test number"
|
||||||
die;;
|
die;;
|
||||||
|
36
readme
36
readme
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
We are working on a performance_testing repository.
|
|
||||||
Here is a history of the commits:
|
|
||||||
|
|
||||||
branch main
|
|
||||||
|
|
||||||
commit f665df376fa57880b5edfb85b156c7703601980e (tag: start)
|
|
||||||
sample0 1M created
|
|
||||||
commit a17812c13a69986c1103e0d06ff0a0b59a3a4a63
|
|
||||||
sample1 1M created
|
|
||||||
commit bd9d8e9421c3253abba47b9def480f1b2d595568
|
|
||||||
sample3 1M created
|
|
||||||
commit 0e599f3b47bf3200dc6e2734df0c6e655c0d8dde
|
|
||||||
sample4 5M created
|
|
||||||
commit effb3cab262e6e1e8242e524e1862b6f77d7ad38
|
|
||||||
sample4 5M deleted
|
|
||||||
|
|
||||||
branch secondary
|
|
||||||
|
|
||||||
commit 643cdbbda81f4c4f26513b9d6ecca3d436e97040
|
|
||||||
sample0 1M created
|
|
||||||
commit b4bac1f2a2c1b4ab325751748b9496cccc65b082
|
|
||||||
sample1 1M created
|
|
||||||
commit e69695f08e79c160045b3319297597a9d8c9b513
|
|
||||||
sample2 500K created
|
|
||||||
|
|
||||||
Which gives us the latest state:
|
|
||||||
branch main
|
|
||||||
sample0 1M
|
|
||||||
sample1 1M
|
|
||||||
sample3 1M
|
|
||||||
|
|
||||||
branch secondary
|
|
||||||
sample0 1M
|
|
||||||
sample1 1M
|
|
||||||
sample2 500K
|
|
Loading…
Reference in New Issue
Block a user