should be the final version of 4
This commit is contained in:
@@ -16,7 +16,7 @@ fifo_client: fifo_client.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# ===== Test files =====
|
||||
test_files:
|
||||
files:
|
||||
@echo "Создание тестовых файлов..."
|
||||
echo "abbaabbaabbaabbaabbaabbaabbaabba" > input1.txt
|
||||
echo "xyzxyzxyzxyzxyzxyzxyzxyz" >> input1.txt
|
||||
@@ -27,17 +27,18 @@ test_files:
|
||||
echo "ppppython" >> input3.txt
|
||||
|
||||
# ===== FIFO tests =====
|
||||
test_fifo_server: fifo test_files
|
||||
test_server: fifo files
|
||||
@echo "=== Запуск FIFO сервера ==="
|
||||
@echo "В другом терминале выполните: make test_fifo_client"
|
||||
@echo "\n\n"
|
||||
./fifo_server 10
|
||||
|
||||
test_fifo_client: fifo test_files
|
||||
@echo "=== Запуск FIFO клиента ===" & \
|
||||
test_client: fifo files
|
||||
@echo "=== Запуск FIFO клиента ===\n\n" & \
|
||||
./fifo_client input1.txt output1_fifo.txt; \
|
||||
./fifo_client input2.txt output2_fifo.txt; \
|
||||
./fifo_client input3.txt output3_fifo.txt;
|
||||
@echo "\n=== Результаты FIFO ==="
|
||||
@echo "\n=== Результаты FIFO ===\n"
|
||||
@echo "--- output1_fifo.txt ---"
|
||||
@cat output1_fifo.txt || true
|
||||
@echo "\n--- output2_fifo.txt ---"
|
||||
@@ -45,35 +46,6 @@ test_fifo_client: fifo test_files
|
||||
@echo "\n--- output3_fifo.txt ---"
|
||||
@cat output3_fifo.txt || true
|
||||
|
||||
# Automatic FIFO test (server in background)
|
||||
test_all: fifo test_files
|
||||
@echo "=== Автоматический тест FIFO ==="
|
||||
@./fifo_server 10 & \
|
||||
SERVER_PID=$$!; \
|
||||
sleep 1; \
|
||||
./fifo_client input1.txt output1_fifo.txt; \
|
||||
./fifo_client input2.txt output2_fifo.txt; \
|
||||
./fifo_client input3.txt output3_fifo.txt; \
|
||||
kill $$SERVER_PID 2>/dev/null || true; \
|
||||
wait $$SERVER_PID 2>/dev/null || true
|
||||
@echo "\n=== Результаты FIFO ==="
|
||||
@echo "--- output1_fifo.txt ---"
|
||||
@cat output1_fifo.txt || true
|
||||
@echo "\n--- output2_fifo.txt ---"
|
||||
@cat output2_fifo.txt || true
|
||||
@echo "\n--- output3_fifo.txt ---"
|
||||
@cat output3_fifo.txt || true
|
||||
|
||||
# Error handling test for FIFO
|
||||
test_error: fifo
|
||||
@echo "\n=== Тест обработки ошибки (несуществующий файл) - FIFO ==="
|
||||
@./fifo_server 5 & \
|
||||
SERVER_PID=$$!; \
|
||||
sleep 1; \
|
||||
./fifo_client nonexistent.txt output_error.txt || true; \
|
||||
kill $$SERVER_PID 2>/dev/null || true; \
|
||||
wait $$SERVER_PID 2>/dev/null || true
|
||||
|
||||
# Cleanup
|
||||
clean:
|
||||
@echo "Очистка..."
|
||||
@@ -85,15 +57,11 @@ clean:
|
||||
# Help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Build FIFO programs"
|
||||
@echo " fifo - Compile fifo_server and fifo_client"
|
||||
@echo " test_files - Create test input files"
|
||||
@echo " test_fifo_server - Run FIFO server (use client in another terminal)"
|
||||
@echo " test_fifo_client - Run FIFO client and show results"
|
||||
@echo " test_all - Automatic FIFO test (server in background)"
|
||||
@echo " test_error - Error handling test (nonexistent file)"
|
||||
@echo " clean - Remove built files and test files"
|
||||
@echo " help - Show this help"
|
||||
@echo " fifo - Compile fifo_server and fifo_client"
|
||||
@echo " files - Create test input files"
|
||||
@echo " test_server - Run FIFO server (use client in another terminal)"
|
||||
@echo " test_client - Run FIFO client and show results
|
||||
@echo " clean - Remove built files and test files"
|
||||
@echo " help - Show this help"
|
||||
|
||||
.PHONY: all fifo test_files test_fifo_server test_fifo_client test_all \
|
||||
test_error clean help
|
||||
.PHONY: all fifo files test_server test_client clean help
|
||||
|
||||
Reference in New Issue
Block a user