Skip to content

Commit

Permalink
ci: Check that vast-front can produce SARIF files.
Browse files Browse the repository at this point in the history
  • Loading branch information
frabert committed Aug 30, 2024
1 parent d29c2ba commit efccba5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ jobs:

- name: Test ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
run: ctest --preset ci-${{ matrix.features }} --build-config ${{ matrix.build-type }}

3 changes: 3 additions & 0 deletions test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
if stdbit_test.returncode == 0:
config.available_features.add("stdbit")

if config.enable_sarif:
config.available_features.add("sarif")

uchar_input = b'''
#include <uchar.h>
Expand Down
4 changes: 4 additions & 0 deletions test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import sys

def to_bool(value):
return value in [True, 'TRUE', 'ON', 1, '1']

config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
Expand Down Expand Up @@ -31,6 +34,7 @@ config.llvm_host_triple = '@LLVM_HOST_TRIPLE@'
config.host_arch = "@HOST_ARCH@"
config.vast_src_root = "@CMAKE_SOURCE_DIR@"
config.vast_obj_root = "@CMAKE_BINARY_DIR@"
config.enable_sarif = to_bool("@VAST_ENABLE_SARIF@")

# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.
Expand Down
12 changes: 12 additions & 0 deletions test/vast/Compile/Sarif/argc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %vast-front -o %t -vast-output-sarif=%t.sarif %s && test -f %t.sarif && cat %t.sarif | %file-check %s
// REQUIRES: sarif

// CHECK: "informationUri": "https://github.com/trailofbits/vast.git",
// CHECK: "name": "vast-front",
// CHECK: "organization": "Trail of Bits, inc.",
// CHECK: "product": "VAST",

int main(int argc, char **argv)
{
return argc;
}

0 comments on commit efccba5

Please sign in to comment.