-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (45 loc) · 2.33 KB
/
Copy pathMakefile
File metadata and controls
56 lines (45 loc) · 2.33 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
OBSERVER = cargo run -q --manifest-path ../../../Cargo.toml -p frogfish-observer --
JAVA_RELEASE = 17
JAVA_BIN = $(shell command -v java)
TARGET_DIR = build
CLASSES = $(TARGET_DIR)/classes
HOST = $(TARGET_DIR)/ledger-observer-host
MAIN = io.frogfish.observer.starter.ObserverHost
TARGET ?= ledger/rejects-overdraft
SOURCES = $(shell find src/main/java -name '*.java')
LIB_SOURCES = $(shell find ../src/main/java -name '*.java')
.PHONY: build list inventory hash run report verify host-run clean
build:
@mkdir -p $(CLASSES)
javac --release $(JAVA_RELEASE) -d $(CLASSES) $(LIB_SOURCES) $(SOURCES)
@printf '%s\n' '#!/bin/sh' 'exec $(JAVA_BIN) -cp "./build/classes" $(MAIN) "$$@"' > $(HOST)
chmod +x $(HOST)
list: build clean
@mkdir -p .observer
./$(HOST) list | tee .observer/provider-list.json
inventory: build
$(OBSERVER) derive-inventory --config observer.toml --provider java > tests.inv
@printf 'wrote %s\n' tests.inv
hash: inventory
@mkdir -p .observer
$(OBSERVER) hash-inventory --inventory tests.inv > .observer/inventory.sha256
$(OBSERVER) hash-suite --suite tests.obs --surface simple > .observer/suite.sha256
@printf 'inventory %s\n' "$$(cat .observer/inventory.sha256)"
@printf 'suite %s\n' "$$(cat .observer/suite.sha256)"
host-run: build
./$(HOST) observe --target "$(TARGET)" --timeout-ms 1000
run: inventory clean
$(OBSERVER) run --inventory tests.inv --suite tests.obs --config observer.toml --surface simple --ui rich --report none --color never --show-output all
report: inventory clean
@mkdir -p .observer
$(OBSERVER) run --inventory tests.inv --suite tests.obs --config observer.toml --surface simple --mode default --ui off --report jsonl > .observer/report.default.jsonl
@printf 'wrote %s\n' .observer/report.default.jsonl
verify: report
$(OBSERVER) hash-inventory --inventory tests.inv > .observer/inventory.sha256
$(OBSERVER) hash-suite --suite tests.obs --surface simple > .observer/suite.sha256
cmp -s expected.inventory.sha256 .observer/inventory.sha256 || diff -u expected.inventory.sha256 .observer/inventory.sha256
cmp -s expected.suite.sha256 .observer/suite.sha256 || diff -u expected.suite.sha256 .observer/suite.sha256
cmp -s expected.default.jsonl .observer/report.default.jsonl || diff -u expected.default.jsonl .observer/report.default.jsonl
@printf 'verified %s\n' expected.default.jsonl
clean:
rm -rf .observer