test 11 avec submodule fonctionnel

This commit is contained in:
eleonore12345 2024-07-08 12:53:38 +02:00
parent c098bf66fe
commit 6556852657
2 changed files with 27 additions and 17 deletions

View File

@ -25,7 +25,6 @@ REPO_PATH=./remote
WITH_SUBMODULE="false" #"true"
SUB_NAME="submodule_for_performance_testing"
while getopts ":h:s" option; do
case $option in
h)
Help
@ -42,7 +41,6 @@ if [ ! -d $REPO_PATH ]; then
mkdir $REPO_PATH
fi
cd $REPO_PATH
echo $(ls -la)
if [ ! -d $REPO_NAME ]; then
mkdir $REPO_NAME
cd $REPO_NAME

View File

@ -1,9 +1,19 @@
#!/bin/bash
. creation_repo.sh &> /dev/null
. driglibash-base
REPO_NAME=performance_testing
REPO_PATH=./remote
WITH_SUBMODULE="true"
SUB_NAME="submodule_for_performance_testing"
FILES_TO_KEEP='sample0'
REMOTE="./remote/performance_testing"
if [ "$WITH_SUBMODULE"="true" ]; then
bash creation_repo.sh -s &> /dev/null
else
bash creation_repo.sh &> /dev/null
fi
Help()
{
echo "
@ -32,6 +42,10 @@ DESCRIPTION
}
#USEFUL FUNCTIONS FOR THE TESTS
create_random_file(){
run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null
}
get_storage_used(){
mem=$(du $1 | tail -n1 | tr -cd [:digit:])
}
@ -293,30 +307,28 @@ test10(){
test11(){
section TEST11
run echo 'TEST 11 : case of --depth=1 fetching and merging, after addition of a 1M file in submodule'
pwd
run git clone --recurse-submodules $1
run git clone --recurse-submodules $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
pwd
ls -la
echo "mem before vaut $mem_before"
#modification of the remote submodule
cd ../$REMOTE/$SUB_NAME
pwd
create_random_file 'sub_sample1' '1M'
git add sub_sample1
git commit --quiet -m"first 1M sample created"
cd ..
cd $REPO_PATH/$SUB_NAME
create_random_file 'sub_sample1' '1M'
git add sub_sample1
git commit --quiet -m"second 1M sample created"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --recommend-shallow
run git fetch --progress --tags --depth=1 -recursive-submodules origin &> /dev/null
git checkout -f -recursive-submodules origin/main &> /dev/null
run git submodule update --init --recursive --force --recommend-shallow --remote &> /dev/null
run git fetch --progress --tags --depth=1 origin #&> /dev/null
git checkout -f origin/main #&> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../$REPO_PATH/$SUB_NAME
git reset --hard -q HEAD~1
cd ../..
#rm -rf performance_testing
}