-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (68 loc) · 2.14 KB
/
Makefile
File metadata and controls
79 lines (68 loc) · 2.14 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
# Conformance Handler Makefile
# Test suite configuration
TEST_VERSION := 0.0.3-alpha.4
TEST_REPO := stringintech/kernel-bindings-tests
TEST_DIR := .conformance-tests
# Platform detection
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_S),Darwin)
ifeq ($(UNAME_M),arm64)
PLATFORM := darwin_arm64
else
PLATFORM := darwin_amd64
endif
else ifeq ($(UNAME_S),Linux)
ifeq ($(UNAME_M),x86_64)
PLATFORM := linux_amd64
else ifeq ($(UNAME_M),aarch64)
PLATFORM := linux_arm64
else
PLATFORM := linux_amd64
endif
else
$(error Unsupported platform: $(UNAME_S) $(UNAME_M))
endif
# Binary names
TEST_RUNNER := $(TEST_DIR)/runner
HANDLER_BIN := handler
.PHONY: all build download-tests test clean help
all: build test
help:
@echo "Conformance Handler Makefile"
@echo ""
@echo "Targets:"
@echo " build - Build the conformance handler binary"
@echo " download-tests - Download the test suite for your platform"
@echo " test - Run conformance tests against the handler"
@echo " clean - Remove built binaries and downloaded tests"
@echo " help - Show this help message"
@echo ""
@echo "Configuration:"
@echo " Test Version: $(TEST_VERSION)"
@echo " Platform: $(PLATFORM)"
build:
@echo "Building conformance handler..."
go build -o $(HANDLER_BIN) .
download-tests:
@echo "Downloading test suite $(TEST_VERSION) for $(PLATFORM)..."
@mkdir -p $(TEST_DIR)
$(eval DOWNLOAD_URL := https://github.com/$(TEST_REPO)/releases/download/v$(TEST_VERSION)/kernel-bindings-tests_$(TEST_VERSION)_$(PLATFORM).tar.gz)
@echo "URL: $(DOWNLOAD_URL)"
@curl -L -o $(TEST_DIR)/test-runner.tar.gz "$(DOWNLOAD_URL)"
@echo "Extracting test runner..."
@tar -xzf $(TEST_DIR)/test-runner.tar.gz -C $(TEST_DIR)
@chmod +x $(TEST_RUNNER)
@rm $(TEST_DIR)/test-runner.tar.gz
@echo "Test runner downloaded to $(TEST_RUNNER)"
test: build
@if [ ! -f "$(TEST_RUNNER)" ]; then \
echo "Test runner not found. Downloading..."; \
$(MAKE) download-tests; \
fi
@echo "Running conformance tests..."
$(TEST_RUNNER) --handler ./$(HANDLER_BIN) -vv
clean:
@echo "Cleaning up..."
rm -f $(HANDLER_BIN)
rm -rf $(TEST_DIR)