Skip to content

Commit f172391

Browse files
Merge pull request #4 from MichaHoffmann/fix_compilation_errors_on_macos
add compile workflow
2 parents 0e7d8dd + 808b2de commit f172391

File tree

626 files changed

+5686
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

626 files changed

+5686
-6
lines changed

.github/workflows/build.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: build
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
compile:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest, windows-latest, macos-latest]
12+
compiler: [gcc, clang++]
13+
14+
name: compile
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- if: matrix.os == 'windows-latest' && matrix.compiler == 'clang++'
20+
uses: KyleMayes/install-llvm-action@v1
21+
with:
22+
version: "11.0"
23+
24+
- if: matrix.os == 'windows-latest' && matrix.compiler == 'gcc'
25+
uses: egor-tensin/setup-mingw@v2
26+
27+
- name: build
28+
run: ${{ matrix.compiler }} -o scanner.o -I./src -c src/scanner.cc

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ log.html
77
tree-sitter-hcl.wasm
88
.env
99
.DS_Store
10+
11+
fuzz/fuzzer
12+
fuzz/*.o
13+
fuzz/*.a
14+
fuzz/fuzz-*.log

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "fuzz/tree-sitter"]
2+
path = fuzz/tree-sitter
3+
url = https://github.com/tree-sitter/tree-sitter.git

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.3.2 - not yet released
4+
5+
fix:
6+
* add a build step to CI to make sure the scanner is compilable
7+
38
## 0.3.1 - 2021-06-30
49

510
fix:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Total parses: 1892; successful parses: 1892; failed parses: 0; success percentag
2828

2929
## Fuzzing
3030

31-
The directory `fuzz/crashers` contains a set of crashes that were found with fuzzing. To fuzz the parser i used the instrumentation of [tree-sitter](https://github.com/tree-sitter/tree-sitter/tree/master/test/fuzz)
31+
The directory `fuzz/crashers` contains a set of crashes that were found with fuzzing.
3232

3333
## Todo
3434

@@ -39,8 +39,8 @@ The directory `fuzz/crashers` contains a set of crashes that were found with fuz
3939
* [x] add heredoc templates
4040
* [ ] fuzzing
4141
* [x] start with fuzzing the parser
42-
* [ ] upload fuzzing instrumentation
42+
* [x] upload fuzzing instrumentation
4343
* [ ] document fuzzing process
4444
* [ ] quality
45-
* [ ] add CI job that ensures the parser builds on different plattforms
45+
* [x] add CI job that ensures the parser builds on different plattforms
4646
* [ ] add CI job that parses crashers that were found during fuzzing

example/example.hcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ resource_1 "strlit1" "strlit2" {
3333
${func("foo${ var.bar }")}
3434
suffix
3535
EOF
36+
func_of_object = func({
37+
"foo": 2,
38+
bar: 1,
39+
fizz: buzz,
40+
})
3641

3742
nested_resource_1 {
3843
attr1 = 2

fuzz/Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FUZZFLAGS=-fsanitize=fuzzer,address,undefined
2+
3+
JOBS=4
4+
WORKERS=4
5+
6+
.PHONY: fuzz
7+
fuzz: fuzzer hcl.dict
8+
UBSAN="print_stacktrace=1:halt_on_error=1:symbolize=1" ASAN_OPTIONS="quarantine_size_mb=10:detect_leaks=1:symbolize=1" ./fuzzer -jobs=${JOBS} -workers=${WORKERS} -dict=hcl.dict corpus/
9+
10+
.PHONY: clean
11+
clean:
12+
rm -rf tree-sitter
13+
rm fuzzer parser.o scanner.o libtree-sitter.a
14+
15+
fuzzer: parser.o scanner.o libtree-sitter.a
16+
clang++ -o fuzzer ${FUZZFLAGS} -std=c++11 tree-sitter/test/fuzz/fuzzer.cc -Itree-sitter/lib scanner.o parser.o libtree-sitter.a
17+
18+
scanner.o: ../src/scanner.cc
19+
clang++ -o scanner.o ${FUZZFLAGS} -std=c++11 -I../src -c ../src/scanner.cc
20+
21+
parser.o: ../src/parser.c
22+
clang -o parser.o ${FUZZFLAGS} -std=c99 -I../src -c ../src/parser.c
23+
24+
hcl.dict:
25+
tree-sitter/scripts
26+
27+
libtree-sitter.a:
28+
make -C tree-sitter
29+
cp tree-sitter/libtree-sitter.a .
30+
615 Bytes
Binary file not shown.
863 Bytes
Binary file not shown.
609 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)