import re


def read_joblist(filelist):
    """
    Read all the files in the filelist, strip all the comments, and return
    the list of test jobs. Each test job is identified by a string.
    """
    joblist = []
    for filename in filelist:
        fp = open(filename,"r")
        lines = fp.readlines()
        fp.close()
        for line in lines:
            mobj = re.search("#",line)
            if mobj:
                # Remove everything after a "#" character
                line = line[:mobj.start()]
            # Delete all leading and trailing whitespace
            line = line.strip()
            # If there is anything left add it to the joblist
            if len(line) > 0:
                joblist.append(line)
    return joblist