// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at http://mozilla.org/MPL/2.0/. // // Copyright (c) 2014-2023, Lars Asplund lars.anders.asplund@gmail.com package vunit_pkg; class test_runner; typedef enum {idle, init, test_suite_setup, test_case_setup, test_case, test_case_cleanup, test_suite_cleanup} phase_t; phase_t phase = idle; string test_cases_found[$]; string test_cases_to_run[$]; string output_path; int test_idx = 0; int exit_without_errors = 0; int trace_fd; function automatic string search_replace(string original, string old, string replacement); // First find the index of the old string int start_index = 0; int original_index = 0; int replace_index = 0; bit found = 0; while(1) begin if (original[original_index] == old[replace_index]) begin if (replace_index == 0) begin start_index = original_index; end replace_index++; original_index++; if (replace_index == old.len()) begin found = 1; break; end end else if (replace_index != 0) begin replace_index = 0; original_index = start_index + 1; end else begin original_index++; end if (original_index == original.len()) begin // Not found break; end end if (!found) return original; return { original.substr(0, start_index-1), replacement, original.substr(start_index+old.len(), original.len()-1) }; endfunction function int setup(string runner_cfg); // Ugly hack pending actual dictionary parsing string prefix; int index; prefix = "enabled_test_cases : "; index = -1; for (int i=0; i