-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
50 lines (37 loc) · 1.19 KB
/
makefile
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
.PHONY: graph clean
all: test graph code
target = test_rnd_nxn_noseq
test:
@echo "Running test..."
@cargo test $(target) -- --show-output > output
graph:
@echo "Cleaning output..."
@cat output | \awk 's{s=s"\n"$$0;} />> BEGIN/{s=$$0;} END{print s;}' > output_1
@echo "Getting graph..."
@sed -e '/^--/!d' output_1 > output_2
@sed 's/-- //' output_2 > output_3
@echo "Cleaning garbage and moving to template"
@echo "sequenceDiagram" > diagram.mermaid
@cat output_3 >> diagram.mermaid
@rm output_*
code:
@echo "Getting wrong test..."
@cat output | \awk 's{s=s"\n"$$0;} />> BEGIN/{s=$$0;} END{print s;}' > output_1
@echo "Getting code..."
@sed -e '/^++/!d' output_1 > output_2
@sed 's/++ //' output_2 > output_3
@echo "Cleaning garbage and moving to template"
@echo "use handoff_register::{handoff::Handoff, types::NodeId};" > code.rs
@echo "#[test]" >> code.rs
@echo "pub fn code(){" >> code.rs
@cat output_3 >> code.rs
@echo "assert_eq!(true, false);" >> code.rs
@echo "}" >> code.rs
@rm output_*
@mv code.rs ./tests/
run_code:
@echo "Running code..."
@cargo test code > output_code
@echo "Generated output_code file"
clean:
@rm diagram.mermaid output ./tests/code.rs