-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathMakefile
57 lines (49 loc) · 1.47 KB
/
Makefile
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
# Makefile for running shell script tests
# Shell to use
SHELL := /bin/bash
# Find all test files
TEST_DIR := tests
TEST_FILES := $(wildcard $(TEST_DIR)/test_*.sh)
# Colors for output
BLUE := \033[1;34m
GREEN := \033[1;32m
RED := \033[1;31m
NC := \033[0m # No Color
.PHONY: all test clean help
# Default target
all: test
# Help message
help:
@echo "Available targets:"
@echo " make test - Run all tests"
@echo " make clean - Clean up temporary files"
@echo " make help - Show this help message"
# Run all tests
test:
@echo -e "$(BLUE)Running tests...$(NC)"
@echo "═══════════════════════════════════════"
@success=true; \
for test in $(TEST_FILES); do \
echo -e "$(BLUE)Running $$test...$(NC)"; \
if chmod +x $$test && ./$$test; then \
echo -e "$(GREEN)✓ $$test passed$(NC)"; \
else \
echo -e "$(RED)✗ $$test failed$(NC)"; \
success=false; \
fi; \
echo "───────────────────────────────────────"; \
done; \
echo ""; \
if $$success; then \
echo -e "$(GREEN)All tests passed successfully!$(NC)"; \
exit 0; \
else \
echo -e "$(RED)Some tests failed!$(NC)"; \
exit 1; \
fi
# Clean up any temporary files (if needed)
clean:
@echo -e "$(BLUE)Cleaning up...$(NC)"
@find $(TEST_DIR) -type f -name "*.tmp" -delete
@find $(TEST_DIR) -type f -name "*.log" -delete
@echo -e "$(GREEN)Cleanup complete$(NC)"