Exemplo n.º 1
0
    def GenerateOneSource(self) -> typing.Tuple[str, int, int]:
        """Generate and return a single CLSmith program.

    Returns:
      A tuple of the source code as a string, the generation time, and the start
      time.
    """
        start_epoch_ms_utc = labdate.MillisecondsTimestamp()
        src = clsmith.Exec(*list(self.config.opt))
        wall_time_ms = labdate.MillisecondsTimestamp() - start_epoch_ms_utc
        return src, wall_time_ms, start_epoch_ms_utc
Exemplo n.º 2
0
def test_Exec_invalid_argument():
    """Test that CLSmithError is raised if invalid args passed to CLSmith."""
    with pytest.raises(clsmith.CLSmithError) as e_ctx:
        clsmith.Exec('--invalid_opt')
    assert '' == str(e_ctx.value)
    assert e_ctx.value.returncode == 255
Exemplo n.º 3
0
def test_Exec_no_args():
    """Test that CLSmith returns a generated file."""
    src = clsmith.Exec()
    # Check the basic structure of the generated file.
    assert src.startswith('// -g ')
    assert '__kernel void ' in src