6-vlad untested

This commit is contained in:
2025-12-10 14:37:14 +07:00
parent 27b7c6c923
commit 02c4d80b5e
4 changed files with 414 additions and 0 deletions

51
lab_6/vlad/Makefile Normal file
View File

@@ -0,0 +1,51 @@
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -g
LDFLAGS_IPC = -lrt -pthread
SHM_NAME ?= /myshm
SEM_CLIENT_NAME ?= /sem_client
SEM_SERVER_NAME ?= /sem_server
SERVER_ITERS ?= 1000
all: shm
shm: server client
server: server.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS_IPC)
client: client.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS_IPC)
test_server: shm
@echo "=== Запуск сервера POSIX SHM+SEM ==="
@echo "В другом терминале выполните: make test_client"
./server $(SHM_NAME) $(SEM_CLIENT_NAME) $(SEM_SERVER_NAME) $(SERVER_ITERS)
test_client: shm
@echo "=== Запуск клиента, чтение input.txt, вывод на stdout ==="
./client $(SHM_NAME) $(SEM_CLIENT_NAME) $(SEM_SERVER_NAME)
test_all: shm
@echo "=== Автотест POSIX SHM+SEM с файлами input.txt/output.txt ==="
./server $(SHM_NAME) $(SEM_CLIENT_NAME) $(SEM_SERVER_NAME) $(SERVER_ITERS) & \
SRV=$$!; \
sleep 1; \
./client $(SHM_NAME) $(SEM_CLIENT_NAME) $(SEM_SERVER_NAME); \
wait $$SRV
clean:
@echo "Очистка..."
rm -f server client
rm -f output.txt
help:
@echo "Available targets:"
@echo " shm - Build POSIX SHM+SEM programs"
@echo " test_server - Run SHM+SEM server (client in another terminal)"
@echo " test_client - Run client reading input.txt"
@echo " test_all - Automatic end-to-end test with input.txt/output.txt"
@echo " clean - Remove built files"
@echo " help - Show this help"
.PHONY: all shm test_server test_client test_all clean help