Skip to content

Skip compilation when no tests match filter#1191

Open
robindust-ce wants to merge 2 commits intoVUnit:masterfrom
robindust-ce:feature/skip-compilation-no-matching-tests
Open

Skip compilation when no tests match filter#1191
robindust-ce wants to merge 2 commits intoVUnit:masterfrom
robindust-ce:feature/skip-compilation-no-matching-tests

Conversation

@robindust-ce
Copy link
Copy Markdown

Suggestion for #1157

Compilation is skipped when no tests match the active filters (e.g. --with-attributes), avoiding unnecessary work when no tests would run.

@LarsAsplund
Copy link
Copy Markdown
Collaborator

I see what your coming from but I think automatically skipping compilation when there are no matching tests would undermine the purpose of the -m flag. The fact that the -m flag doesn't prevent compilation when the test list is empty is the real problem. One could argue that the -m flag should be default. Why compile anything that isn't needed for running the tests passing the filters? We've chosen the fail fast approach, i.e. if there are syntactic errors we should expose those ASAP. For those that prefer having -m as the default, it is always possible to enforce that in the run script.

To fix the current issue with the -m flag, I think the or expression on this line should be replaced by:

target_files if target_files is not None else self.get_source_files_in_order()

Makes sense?

@robindust-ce
Copy link
Copy Markdown
Author

Yes that makes sense and would be satisfactory for me. However, I have never considered -m because it does not work when component instantiations are bound at elaboration time. In this example dut.vhd (in the library "common") will not be compiled using -m even if my testbench depends on it.

library ieee;
use ieee.std_logic_1164.all;

library vunit_lib;
context vunit_lib.vunit_context;

library common;

entity tb_component is
  generic (runner_cfg : string);
end entity;

architecture struct of tb_component is
  component dut is
    port (
      clk  : in  std_logic;
      data : out std_logic
    );
  end component;

  signal clk  : std_logic := '0';
  signal data : std_logic;
begin
  -- Component instantiation: default binding resolves to common.ram_ecc
  i_dut : dut port map (clk => clk, data => data);

  main : process
  begin
    test_runner_setup(runner, runner_cfg);
    clk <= '1';
    wait for 10 ns;
    check_equal(data, '1', "data should be driven");
    test_runner_cleanup(runner);
  end process;
end architecture;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants