bw dans une fonction séparée
This commit is contained in:
parent
e597acad2c
commit
b01eae167f
@ -34,18 +34,29 @@ get_storage_used(){
|
||||
mem=$(du $1 | tail -n1 | tr -cd [:digit:])
|
||||
}
|
||||
|
||||
get_bandwidth(){
|
||||
if [ "$2"="cloning"]; then
|
||||
bw=$(grep -e "Receiving objects:" $1 | grep -o "Receiving objects: [[:alnum:]%/(),. ]*" | tail -n1)
|
||||
echo "1 : $bw"
|
||||
bw=${bw#*,}
|
||||
echo "2 : $bw"
|
||||
elif [ "$2"="fetching" ]; then
|
||||
bw=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
|
||||
echo "bw vaut $bw"
|
||||
fi
|
||||
}
|
||||
|
||||
#TESTS ON THE INITIAL CLONING
|
||||
#TESTS ON THE INITIAL POPULATING OF THE REPO
|
||||
test0(){
|
||||
section TEST0
|
||||
echo "TEST 0 : case of classic cloning."
|
||||
git clone --progress --no-local $1 2> cloning_text
|
||||
get_storage_used "./$REPO_NAME"
|
||||
bw0=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
||||
get_bandwidth cloning_text
|
||||
echo "memory usage in a classic cloning : $mem"
|
||||
echo "bandwidth usage : $bw0"
|
||||
echo "bandwidth usage : $bw"
|
||||
run rm cloning_text
|
||||
run rm -rf $REPO_NAME
|
||||
run rm -rf $REPO_NAME
|
||||
}
|
||||
|
||||
test1(){
|
||||
@ -53,9 +64,9 @@ test1(){
|
||||
echo "TEST 1 : case of --single-branch cloning."
|
||||
git clone --progress --single-branch --no-local $1 2> cloning_text
|
||||
get_storage_used ./$REPO_NAME
|
||||
bw1=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
||||
get_bandwidth cloning_text
|
||||
echo "memory usage in a --single-branch cloning : $mem"
|
||||
echo "bandwidth usage : $bw1"
|
||||
echo "bandwidth usage : $bw"
|
||||
run rm cloning_text
|
||||
run rm -rf $REPO_NAME
|
||||
}
|
||||
@ -65,9 +76,9 @@ test2(){
|
||||
echo "TEST 2 : case of --depth=1 --no-single-branch"
|
||||
git clone --progress --depth=1 --no-local --no-single-branch $1 2> cloning_text
|
||||
get_storage_used ./$REPO_NAME
|
||||
bw2=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
||||
get_bandwidth cloning_text
|
||||
echo "memory usage in a --depth=1 --no-single-branch cloning : $mem"
|
||||
echo "bandwidth usage : $bw2"
|
||||
echo "bandwidth usage : $bw"
|
||||
run rm cloning_text
|
||||
run rm -rf $REPO_NAME
|
||||
}
|
||||
@ -77,9 +88,9 @@ test3(){
|
||||
echo "TEST 3 : case of --depth=1 with single-branch (default))"
|
||||
git clone --progress --single-branch --no-local --depth=1 $1 2> cloning_text
|
||||
get_storage_used ./$REPO_NAME
|
||||
bw3=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
|
||||
get_bandwidth cloning_text
|
||||
echo "memory usage in a --depth=1 with single-branch cloning : $mem"
|
||||
echo "bandwidth usage : $bw3"
|
||||
echo "bandwidth usage : $bw"
|
||||
run rm cloning_text
|
||||
run rm -rf $REPO_NAME
|
||||
}
|
||||
@ -88,10 +99,12 @@ test4(){
|
||||
section TEST4
|
||||
run mkdir $REPO_NAME
|
||||
run echo "TEST 4 : case of sparse-checking only $FILES_TO_KEEP with depth=1"
|
||||
#creating a git repo with sparse-checking settings
|
||||
run cd $REPO_NAME
|
||||
run git init -q
|
||||
run git config core.sparsecheckout true
|
||||
run echo $FILES_TO_KEEP >> .git/info/sparse-checkout
|
||||
#pulling from the remote with sparse-checking enabled
|
||||
run git remote add -f origin ../$1 &> /dev/null
|
||||
run git pull origin main &> /dev/null
|
||||
get_storage_used .
|
||||
@ -123,9 +136,9 @@ test5(){
|
||||
get_storage_used .
|
||||
mem_after=$mem
|
||||
mem=$(($mem_after-$mem_before))
|
||||
bw5=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
|
||||
get_bandwidth . fetching
|
||||
echo "memory usage: +$mem"
|
||||
echo "bandwidth usage: $bw5"
|
||||
echo "bandwidth usage: $bw"
|
||||
cd ../$REMOTE
|
||||
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
|
||||
cd ../..
|
||||
@ -152,9 +165,9 @@ test6(){
|
||||
get_storage_used .
|
||||
mem_after=$mem
|
||||
mem=$(($mem_after-$mem_before))
|
||||
bw6=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
|
||||
get_bandwidth . fetching
|
||||
echo "memory usage: $mem"
|
||||
echo "bandwidth usage: $bw6"
|
||||
echo "bandwidth usage: $bw"
|
||||
cd ../$REMOTE
|
||||
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
|
||||
cd ../..
|
||||
@ -162,7 +175,7 @@ test6(){
|
||||
}
|
||||
|
||||
test7(){
|
||||
section TEST7
|
||||
section TEST7
|
||||
run echo 'TEST 7 : case of classic fetching and merging, after addition then removal of a 1M file'
|
||||
run git clone $1 &> /dev/null
|
||||
cd $REPO_NAME
|
||||
|
Loading…
Reference in New Issue
Block a user