Skip to content

Commit

Permalink
pr: Add SARIF test.
Browse files Browse the repository at this point in the history
  • Loading branch information
frabert committed Nov 21, 2024
1 parent 647be83 commit 13686c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(VAST_TEST_DEPENDS
vast-query
vast-opt
vast-front
detect-parsers
)

add_lit_testsuite(check-vast "Running the VAST regression tests"
Expand Down
1 change: 1 addition & 0 deletions test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"-nostdsysteminc"
]
),
ToolSubst('%detect-parsers', command = 'detect-parsers'),
ToolSubst('%file-check', command = 'FileCheck'),
ToolSubst('%cc', command = config.host_cc)
]
Expand Down
5 changes: 5 additions & 0 deletions test/parsers/rle-a.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %vast-front -vast-emit-mlir=hl %s -o - | %file-check %s -check-prefix=HL
// RUN: %vast-front -vast-show-locs -vast-loc-attrs -vast-emit-mlir=hl %s -o - | %detect-parsers -vast-hl-to-parser -parser-source-to-sarif=output=/dev/stdout out.mlir -o /dev/null | %file-check %s -check-prefix=SARIF

#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -38,10 +39,14 @@ void parse_binary_file(const char *filename) {

// Read header (4 bytes) - contains length of compressed data
uint32_t compressed_length;
// SARIF: "startColumn": 5
// SARIF: "startLine": 43
fread(&compressed_length, sizeof(uint32_t), 1, file);

// Allocate memory for compressed data
uint8_t *compressed_data = (uint8_t *)malloc(compressed_length);
// SARIF: "startColumn": 5
// SARIF: "startLine": 49
fread(compressed_data, sizeof(uint8_t), compressed_length, file);

// Close the file after reading
Expand Down

0 comments on commit 13686c9

Please sign in to comment.