def ManifestCommand(argv): parser = optparse.OptionParser( description=( 'Read in one or more DejaGNU summary files (.sum), parse their ' 'content and generate manifest files. Manifest files store a list ' 'of failed tests that should be ignored. Generated files are ' 'stored in current directory under following name: ' '${tool}-${board}.xfail (e.g. "gcc-unix.xfail").'), usage='Usage: %prog manifest [file.sum] (file2.sum ...)') _, args = parser.parse_args(argv[2:]) with OptionChecker(parser): if not args: sys.exit('At least one *.sum file required.') for filename in chain.from_iterable(map(glob.glob, args)): test_run = DejaGnuTestRun.FromFile(filename) manifest = Manifest.FromDejaGnuTestRun(test_run) manifest_filename = '%s-%s.xfail' % (test_run.tool, test_run.board) with open(manifest_filename, 'w') as manifest_file: manifest_file.write(manifest.Generate()) logging.info('Wrote manifest to "%s" file.', manifest_filename)