def test_load_yaml_basic():
    """query_traces_yaml.load_yaml: Load some basic YAML documents"""

    for i in YAML_DATA:
        y = qty.load_yaml(i[0])

        assert i[1] == y
Exemple #2
0
def _checksum(args):
    y = qty.load_yaml(args.yaml_file)

    traces = y['traces']
    try:
        trace = next(t for t in traces if t['path'] == args.file_path)
    except StopIteration:
        print("")
        return

    print(qty.trace_checksum(trace, args.device_name))
Exemple #3
0
def _traces(args):
    y = qty.load_yaml(args.yaml_file)

    t_list = qty.traces(y,
                        trace_extensions=args.trace_extensions,
                        device_name=args.device_name,
                        checksum=args.checksum)

    if args.checksum:
        print('\n'.join(((t['path'] + '\n' + t['checksum'])
                         for t in t_list)))
    else:
        print('\n'.join((t['path'] for t in t_list)))
Exemple #4
0
def from_yaml(yaml_file):
    y = qty.load_yaml(yaml_file)

    OPTIONS.set_download_url(qty.download_url(y))

    global_result = Result.MATCH
    # TODO: print in subtest format
    # json_results = {}
    t_list = qty.traces(y, device_name=OPTIONS.device_name, checksum=True)
    for t in t_list:
        result, json_result = _check_trace(t['path'], t['checksum'])
        if result is not Result.MATCH and global_result is not Result.FAILURE:
            global_result = result
        # json_results.update(json_result)
        # _print_result(result, t['path'], json_result)

    return global_result
Exemple #5
0
    def __init__(self, filename, device_name):
        try:
            with open(filename, 'r') as f:
                self.yaml = qty.load_yaml(f)
        except FileNotFoundError:
            raise exceptions.PiglitFatalError(
                'Cannot open "{}"'.format(filename))

        self.device_name = device_name
        self.extra_args = ['--device-name', device_name,
                           '--download-url', qty.download_url(self.yaml)] \
                           + _EXTRA_ARGS
        self.forced_test_list = []
        self.filters = profile.Filters()
        self.options = {
            'dmesg': profile.get_dmesg(False),
            'monitor': profile.Monitoring(False),
            'ignore_missing': False,
        }
def test_load_yaml_PiglitFatalError():
    """query_traces_yaml.load_yaml: Raise PiglitFatalError on invalid YAML"""
    y = qty.load_yaml("*** this is not YAML ***")
Exemple #7
0
def _traces_db_download_url(args):
    y = qty.load_yaml(args.yaml_file)

    url = qty.download_url(y) or ""

    print(url)