-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·133 lines (107 loc) · 3.43 KB
/
run.sh
File metadata and controls
executable file
·133 lines (107 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
# Vallm Examples Runner
# This script runs all examples sequentially and generates analysis reports
set -e # Exit on any error
echo "🚀 Running Vallm Examples"
echo "========================"
# List of example directories in order
EXAMPLES=(
"01_basic_validation"
"02_ast_comparison"
"03_security_check"
"04_graph_analysis"
"05_llm_semantic_review"
"06_multilang_validation"
"07_multi_language"
"08_code2llm_integration"
"09_code2logic_integration"
)
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to run an example
run_example() {
local example_dir=$1
echo -e "\n${BLUE}📁 Running example: ${example_dir}${NC}"
echo "----------------------------------------"
if [ ! -d "$example_dir" ]; then
echo -e "${RED}❌ Example directory $example_dir not found${NC}"
return 1
fi
if [ ! -f "$example_dir/main.py" ]; then
echo -e "${RED}❌ main.py not found in $example_dir${NC}"
return 1
fi
# Change to example directory and run
cd "$example_dir"
# Clean any previous .vallm folder
if [ -d ".vallm" ]; then
rm -rf .vallm
fi
echo -e "${YELLOW}▶️ Running python main.py${NC}"
# Run the example and capture output
if python main.py 2>&1; then
echo -e "${GREEN}✅ Example $example_dir completed successfully${NC}"
# Check if analysis data was generated
if [ -d ".vallm" ]; then
echo -e "${GREEN}📊 Analysis data generated in .vallm/ folder${NC}"
ls -la .vallm/
else
echo -e "${YELLOW}⚠️ No .vallm folder generated${NC}"
fi
else
echo -e "${RED}❌ Example $example_dir failed${NC}"
cd ..
return 1
fi
cd ..
echo ""
}
# Main execution
echo -e "${BLUE}Starting sequential execution of ${#EXAMPLES[@]} examples...${NC}"
total_start_time=$(date +%s)
failed_examples=()
for example in "${EXAMPLES[@]}"; do
start_time=$(date +%s)
if ! run_example "$example"; then
failed_examples+=("$example")
fi
end_time=$(date +%s)
duration=$((end_time - start_time))
echo -e "${BLUE}⏱️ Time taken: ${duration}s${NC}"
echo "========================================"
done
total_end_time=$(date +%s)
total_duration=$((total_end_time - total_start_time))
# Final summary
echo -e "\n${BLUE}📋 EXECUTION SUMMARY${NC}"
echo "========================"
echo -e "${BLUE}Total time: ${total_duration}s${NC}"
echo -e "${BLUE}Examples run: ${#EXAMPLES[@]}${NC}"
if [ ${#failed_examples[@]} -eq 0 ]; then
echo -e "${GREEN}✅ All examples completed successfully!${NC}"
else
echo -e "${RED}❌ Failed examples (${#failed_examples[@]}):${NC}"
for failed in "${failed_examples[@]}"; do
echo -e "${RED} - $failed${NC}"
done
fi
# Generate overall summary
echo -e "\n${BLUE}📊 ANALYSIS DATA SUMMARY${NC}"
echo "=========================="
for example in "${EXAMPLES[@]}"; do
if [ -d "$example/.vallm" ]; then
echo -e "${GREEN}📁 $example:${NC}"
ls -1 "$example/.vallm/" | sed 's/^/ - /'
else
echo -e "${YELLOW}📁 $example: No analysis data${NC}"
fi
done
echo -e "\n${GREEN}🎉 Vallm examples runner completed!${NC}"
# Exit with error code if any examples failed
if [ ${#failed_examples[@]} -gt 0 ]; then
exit 1
fi