blob: 49acba0cee80669e0e88af8fc58d53ce1a5a6cf5 [file] [log] [blame]
#!/usr/bin/env python
import os
import optparse
def main():
parser = optparse.OptionParser("""\
usage: %%prog [options] <test-path>
Print the RUNTESTFLAGS used by DejaGNU to run an individual test.\
""" % locals())
opts,args = parser.parse_args()
if len(args) != 1:
parse.error("invalid number of arguments")
path, = args
# Locate the name of the .exp file to use. We expect it to be the sole one
# in the test directory.
abspath = os.path.abspath(path)
test_dir_path = os.path.dirname(abspath)
exp_files = [name for name in os.listdir(test_dir_path)
if name.endswith('.exp')]
if not exp_files:
raise SystemExit,"unable to find any .exp files in %r" % (
if len(exp_files) > 1:
raise SystemExit,"multiple .exp files in %r, unable to pick one" % (
# Otherwise, we found the suite name, turn it into a runtestflags arg.
print "%s=%s" % (exp_files[0], os.path.basename(abspath))
if __name__ == '__main__':