<commit_before>SOURCE_FILES := $(shell find . \( -name '*.go' -not -path './vendor*' \))
INTEGRATION_TESTS := $(shell find tests -name 'test-*.py' -exec basename {} .py \;)
VERSION := $(shell git describe --always --dirty)

# Ghostunnel binary
ghostunnel: $(SOURCE_FILES)
	go build -ldflags '-X main.version=${VERSION}' -o ghostunnel .

# Test binary with coverage instrumentation
ghostunnel.test: $(SOURCE_FILES)
	go test -c -covermode=count -coverpkg .

# Clean build output
clean:
	rm -rf ghostunnel *.out */*.out ghostunnel.test tests/__pycache__

# Run all tests (unit + integration tests)
test: unit $(INTEGRATION_TESTS)
	gocovmerge *.out */*.out > coverage-merged.out
	@echo "PASS"
.PHONY: test

# Run unit tests
unit:
	go test -v -covermode=count -coverprofile=coverage-unit-test-base.out .
	go test -v -covermode=count -coverprofile=coverage-unit-test-auth.out ./auth
.PHONY: unit

# Run integration tests
$(INTEGRATION_TESTS): ghostunnel.test
	@cd tests && ./runner.py $@
.PHONY: $(INTEGRATION_TESTS)

# Import test keys into SoftHSM (v2)
softhsm-import:
	softhsm2-util --init-token --slot 0 \
		--label ${GHOSTUNNEL_TEST_PKCS11_LABEL} \
		--so-pin ${GHOSTUNNEL_TEST_PKCS11_PIN} \<commit_msg>Mark clean makefile target as phony<commit_after>SOURCE_FILES := $(shell find . \( -name '*.go' -not -path './vendor*' \))
INTEGRATION_TESTS := $(shell find tests -name 'test-*.py' -exec basename {} .py \;)
VERSION := $(shell git describe --always --dirty)

# Ghostunnel binary
ghostunnel: $(SOURCE_FILES)
	go build -ldflags '-X main.version=${VERSION}' -o ghostunnel .

# Test binary with coverage instrumentation
ghostunnel.test: $(SOURCE_FILES)
	go test -c -covermode=count -coverpkg .

# Clean build output
clean:
	rm -rf ghostunnel *.out */*.out ghostunnel.test tests/__pycache__
.PHONY: clean

# Run all tests (unit + integration tests)
test: unit $(INTEGRATION_TESTS)
	gocovmerge *.out */*.out > coverage-merged.out
	@echo "PASS"
.PHONY: test

# Run unit tests
unit:
	go test -v -covermode=count -coverprofile=coverage-unit-test-base.out .
	go test -v -covermode=count -coverprofile=coverage-unit-test-auth.out ./auth
.PHONY: unit

# Run integration tests
$(INTEGRATION_TESTS): ghostunnel.test
	@cd tests && ./runner.py $@
.PHONY: $(INTEGRATION_TESTS)

# Import test keys into SoftHSM (v2)
softhsm-import:
	softhsm2-util --init-token --slot 0 \
		--label ${GHOSTUNNEL_TEST_PKCS11_LABEL} \
		--so-pin ${GHOSTUNNEL_TEST_PKCS11_PIN} \
{'fraction_non_alphanumeric': 0.1483606557377049, 'fraction_numerical': 0.005737704918032787, 'mean_word_length': 4.012320328542095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '991786', 'n_tokens_mistral': 887, 'n_tokens_neox': 873, 'n_words': 239}