Ajout de nouveaux fichiers de test et suppression de fichiers obsolètes
This commit is contained in:
113
tests/test-03-circular/run_test03.sh
Executable file
113
tests/test-03-circular/run_test03.sh
Executable file
@@ -0,0 +1,113 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de test pour comparer bake et make
|
||||
# Test 03 - Gestion des dépendances circulaires
|
||||
|
||||
# Création du répertoire de logs s'il n'existe pas
|
||||
mkdir -p logs
|
||||
|
||||
# Fichier de log avec timestamp pour éviter les écrasements
|
||||
LOG_FILE="logs/test03_$(date +%Y%m%d_%H%M%S).log"
|
||||
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
echo "Test 03 - Gestion des dépendances circulaires" | tee -a "$LOG_FILE"
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
echo "" | tee -a "$LOG_FILE"
|
||||
|
||||
# Nettoyage préalable pour s'assurer qu'on part de zéro
|
||||
echo "Nettoyage préalable..." | tee -a "$LOG_FILE"
|
||||
# Pour make, supprimer tous les fichiers objets et l'exécutable
|
||||
cd make
|
||||
rm -f main a b c 2>/dev/null
|
||||
cd ..
|
||||
|
||||
# Pour bake, supprimer tous les fichiers objets et l'exécutable
|
||||
cd bake
|
||||
rm -f main a b c 2>/dev/null
|
||||
cd ..
|
||||
echo "Nettoyage terminé." | tee -a "$LOG_FILE"
|
||||
echo "" | tee -a "$LOG_FILE"
|
||||
|
||||
# Test avec make
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
echo "Exécution de MAKE avec dépendances circulaires:" | tee -a "$LOG_FILE"
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
cd make
|
||||
echo "$ make" | tee -a "../$LOG_FILE"
|
||||
make 2>&1 | tee -a "../$LOG_FILE"
|
||||
MAKE_EXIT_CODE=$?
|
||||
echo "" | tee -a "../$LOG_FILE"
|
||||
echo "Code de sortie: $MAKE_EXIT_CODE" | tee -a "../$LOG_FILE"
|
||||
|
||||
# Vérifier si les fichiers objets et l'exécutable ont été créés
|
||||
if [ -f "main" ] && [ -f "a" ] && [ -f "b" ] && [ -f "c" ]; then
|
||||
echo "✅ make: Tous les fichiers ont été générés avec succès" | tee -a "../$LOG_FILE"
|
||||
# Exécuter le programme pour vérifier qu'il fonctionne
|
||||
if [ -x "main" ]; then
|
||||
echo "$ ./main" | tee -a "../$LOG_FILE"
|
||||
./main 2>&1 | tee -a "../$LOG_FILE"
|
||||
fi
|
||||
else
|
||||
echo "❌ make: Certains fichiers n'ont pas été générés" | tee -a "../$LOG_FILE"
|
||||
echo " - main: $([ -f "main" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
echo " - a: $([ -f "a" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
echo " - b: $([ -f "b" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
echo " - c: $([ -f "c" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
fi
|
||||
cd ..
|
||||
|
||||
echo "" | tee -a "$LOG_FILE"
|
||||
|
||||
# Test avec bake
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
echo "Exécution de BAKE avec dépendances circulaires:" | tee -a "$LOG_FILE"
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
cd bake
|
||||
echo "$ java -cp bakefile.jar fr.monlouyan.bakefile.Main" | tee -a "../$LOG_FILE"
|
||||
java -cp bakefile.jar fr.monlouyan.bakefile.Main 2>&1 | tee -a "../$LOG_FILE"
|
||||
BAKE_EXIT_CODE=$?
|
||||
echo "" | tee -a "../$LOG_FILE"
|
||||
echo "Code de sortie: $BAKE_EXIT_CODE" | tee -a "../$LOG_FILE"
|
||||
|
||||
# Vérifier si les fichiers objets et l'exécutable ont été créés
|
||||
if [ -f "main" ] && [ -f "a" ] && [ -f "b" ] && [ -f "c" ]; then
|
||||
echo "✅ bake: Tous les fichiers ont été générés avec succès" | tee -a "../$LOG_FILE"
|
||||
# Exécuter le programme pour vérifier qu'il fonctionne
|
||||
if [ -x "main" ]; then
|
||||
echo "$ ./main" | tee -a "../$LOG_FILE"
|
||||
./main 2>&1 | tee -a "../$LOG_FILE"
|
||||
fi
|
||||
else
|
||||
echo "❌ bake: Certains fichiers n'ont pas été générés" | tee -a "../$LOG_FILE"
|
||||
echo " - main: $([ -f "main" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
echo " - a: $([ -f "a" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
echo " - b: $([ -f "b" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
echo " - c: $([ -f "c" ] && echo '✅' || echo '❌')" | tee -a "../$LOG_FILE"
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# Résumé des résultats
|
||||
echo "" | tee -a "$LOG_FILE"
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
echo "RÉSUMÉ:" | tee -a "$LOG_FILE"
|
||||
echo "=================================" | tee -a "$LOG_FILE"
|
||||
|
||||
# Vérifier si make et bake ont réussi à gérer les dépendances circulaires
|
||||
cd make
|
||||
MAKE_SUCCESS=$([ -f "main" ] && [ -f "a" ] && [ -f "b" ] && [ -f "c" ] && echo "true" || echo "false")
|
||||
cd ../bake
|
||||
BAKE_SUCCESS=$([ -f "main" ] && [ -f "a" ] && [ -f "b" ] && [ -f "c" ] && echo "true" || echo "false")
|
||||
cd ..
|
||||
|
||||
if [ "$MAKE_SUCCESS" = "true" ] && [ "$BAKE_SUCCESS" = "true" ]; then
|
||||
echo "✅ Les deux outils ont géré correctement les dépendances circulaires" | tee -a "$LOG_FILE"
|
||||
elif [ "$MAKE_SUCCESS" = "false" ] && [ "$BAKE_SUCCESS" = "false" ]; then
|
||||
echo "❌ Les deux outils ont échoué à gérer les dépendances circulaires" | tee -a "$LOG_FILE"
|
||||
else
|
||||
echo "⚠️ Comportement différent entre make et bake:" | tee -a "$LOG_FILE"
|
||||
echo " - make: $([ "$MAKE_SUCCESS" = "true" ] && echo '✅ A réussi' || echo '❌ A échoué')" | tee -a "$LOG_FILE"
|
||||
echo " - bake: $([ "$BAKE_SUCCESS" = "true" ] && echo '✅ A réussi' || echo '❌ A échoué')" | tee -a "$LOG_FILE"
|
||||
fi
|
||||
|
||||
echo "" | tee -a "$LOG_FILE"
|
||||
echo "Test terminé. Résultats enregistrés dans: $LOG_FILE" | tee -a "$LOG_FILE"
|
Reference in New Issue
Block a user