Skip to content

Commit

Permalink
add test filter for integration test (keep-starknet-strange#508)
Browse files Browse the repository at this point in the history
* add test filter for integration test

* refactor comment
  • Loading branch information
TropicalDog17 authored Apr 24, 2024
1 parent da119ae commit 41f6ed0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ run-integration-test:
@zig build integration_test
./zig-out/bin/integration_test

run-integration-test-filter:
@zig build integration_test
./zig-out/bin/integration_test $(FILTER)

build-and-run-pedersen-table-gen:
@zig build pedersen_table_gen
> ./src/math/crypto/pedersen/gen/constants.zig
Expand Down
10 changes: 9 additions & 1 deletion src/integration_tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const CairoVM = @import("vm/core.zig").CairoVM;
const CairoRunner = @import("vm/runners/cairo_runner.zig").CairoRunner;
const HintProcessor = @import("./hint_processor/hint_processor_def.zig").CairoVMHintProcessor;

pub fn main() void {
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
// Given
const allocator = gpa.allocator();
Expand Down Expand Up @@ -227,6 +227,10 @@ pub fn main() void {
.{ .pathname = "cairo_programs/usort.json", .layout = "all_cairo" },
};

const args = try std.process.argsAlloc(allocator);
defer std.process.argsFree(allocator, args);
const test_substring = if (args.len > 1) args[1] else "";

var ok_count: usize = 0;
var fail_count: usize = 0;
var progress = std.Progress{
Expand All @@ -237,6 +241,10 @@ pub fn main() void {
(progress.supports_ansi_escape_codes or progress.is_windows_terminal);

for (cairo_programs, 0..) |test_cairo_program, i| {
// Check if the current test's pathname contains the provided test filter substring
if (test_substring.len > 0 and !std.mem.containsAtLeast(u8, test_cairo_program.pathname, 1, test_substring)) {
continue;
}
var test_node = root_node.start(test_cairo_program.pathname, 0);
test_node.activate();
progress.refresh();
Expand Down

0 comments on commit 41f6ed0

Please sign in to comment.