if len(sys.argv) > 1: if ((sys.argv[1] == '-h') or (len(sys.argv) > 3)): help() exit() if len(sys.argv) == 2: cwe_regex = sys.argv[1] if len(sys.argv) == 3: cwe_regex = sys.argv[1] use_debug = (sys.argv[2] == "True") # get the CWE directories in testcases folder cwe_dirs = py_common.find_directories_in_dir("testcases", cwe_regex) # only allow directories cwe_dirs = filter(lambda x: os.path.isdir(x), cwe_dirs) for dir in cwe_dirs: if 's01' in os.listdir(dir): is_dir_split = True else: is_dir_split = False if is_dir_split: # get the list of subdirectories cwe_sub_dirs = py_common.find_directories_in_dir(dir, "^s\d.*") for sub_dir in cwe_sub_dirs:
# default value which is used if no arguments are passed on command line cwe_regex="CWE" if len(sys.argv) > 2: help() exit() if len(sys.argv) == 2: if (sys.argv[1] == '-h'): help() exit() cwe_regex = sys.argv[1] # get the CWE directories in testcases folder cwe_dirs = py_common.find_directories_in_dir("src\\testcases", cwe_regex) # only allow directories cwe_dirs = filter(lambda x: os.path.isdir(x), cwe_dirs) for dir in cwe_dirs: # copy build.xml template into this testcase dir build_xml_template_file = "build.xml.template" build_xml_target_file = os.path.join(dir, "build.xml") shutil.copy(build_xml_template_file, build_xml_target_file) # copy web.xml template into this testcase dir web_xml_template_file = "web.xml.template" web_xml_target_file = os.path.join(dir, "web.xml") shutil.copy(web_xml_template_file, web_xml_target_file)
# default value which is used if no arguments are passed on command line cwe_regex="CWE" if len(sys.argv) > 2: help() exit() if len(sys.argv) == 2: if (sys.argv[1] == '-h'): help() exit() cwe_regex = sys.argv[1] # get the CWE directories in testcases folder cwe_dirs = py_common.find_directories_in_dir("src\\testcases", cwe_regex) # only allow directories cwe_dirs = filter(lambda x: os.path.isdir(x), cwe_dirs) for dir in cwe_dirs: if 's01' in os.listdir(dir): is_dir_split = True else: is_dir_split = False if is_dir_split: # get the list of subdirectories cwe_sub_dirs = py_common.find_directories_in_dir(dir, "^s\d.*") for sub_dir in cwe_sub_dirs:
cwe_regex = sys.argv[1] if len(sys.argv) == 5: if (sys.argv[1] == '-h'): help() exit() cwe_regex = sys.argv[1] auto_build_sln = True if sys.argv[3] == "True": OMITBAD = True if sys.argv[4] == "True": OMITGOOD = True # get the CWE directories in testcases folder cwe_dirs = py_common.find_directories_in_dir( os.path.join('src', 'testcases'), cwe_regex) # only allow directories cwe_dirs = filter(lambda x: os.path.isdir(x), cwe_dirs) for dir in cwe_dirs: if 's01' in os.listdir(dir): is_dir_split = True else: is_dir_split = False if is_dir_split: # get the list of subdirectories cwe_sub_dirs = py_common.find_directories_in_dir(dir, "^s\d.*") for sub_dir in cwe_sub_dirs: