Go to the documentation of this file.
6 from pathlib
import Path
9 seperatorStr =
"=============================================="
34 if " Testing: " in line:
37 out[
"name"] = parts[2]
41 out[
"log"].append(seperatorStr)
42 out[
"log"].append(seperatorStr)
43 out[
"log"].append(seperatorStr)
50 out[
"log"].append(line)
51 if line.startswith(
"Command: "):
52 parts = line.split(
' ', 1)
53 out[
"command"] = parts[1]
61 out[
"log"].append(line)
62 if line.startswith(
"Directory: "):
69 out[
"cmpDir"] = out[
"dir"]
70 parts = out[
"command"].split(
'&&')
73 if cmd.startswith(
"cd "):
74 cmdParts = cmd.split()
77 newPath = Path(out[
"cmpDir"]) / newDir
78 newDir =
str(newPath.resolve())
79 out[
"cmpDir"] = newDir
80 elif cmd.startswith(
"nccmp ")
or cmd.startswith(
"compare_hdf4 ")
or cmd.startswith(
"diff ")
or cmd.startswith(
"tiffcmp ") :
81 cmdParts = cmd.split()
82 out[
"newFile"].append(out[
"cmpDir"] +
"/" + cmdParts[-1].strip().rstrip(
'"'))
83 out[
"oldFile"].append(out[
"cmpDir"] +
"/" + cmdParts[-2].strip())
85 elif cmd.startswith(
"compare "):
86 cmdParts = cmd.split()
87 out[
"newFile"].append(out[
"cmpDir"] +
"/" + cmdParts[-2].strip())
88 out[
"oldFile"].append(out[
"cmpDir"] +
"/" + cmdParts[-3].strip())
95 parts = line.split(
"/")
96 if parts[-2] ==
"testdata":
97 out[
"cdataDir"] = line
98 elif parts[-3] ==
"testdata":
100 out[
"cdataDir"] =
"/".join(parts)
102 print(
"ERROR: can't find cdataDir")
103 print(
" name =", out[
"name"])
104 print(
" cmpDir =", out[
"cmpDir"])
109 s = out[
"cdataDir"] +
"/"
110 for i
in range(len(out[
"newFile"])):
111 out[
"newFile"][i] = out[
"newFile"][i].replace(s,
"")
112 out[
"oldFile"][i] = out[
"oldFile"][i].replace(s,
"")
120 out[
"log"].append(line)
121 if lastLine.startswith(
"-----------------------------------------"):
122 if line ==
"Test Passed.\n":
123 out[
"failed"] =
False
125 if line ==
"Test Failed.\n":
147 if rec[
"valid"]
and rec[
"failed"]:
150 cmdList.append(
"cd " + rec[
"cdataDir"])
151 for i
in range(len(rec[
"newFile"])):
152 cmdList.append(
"cp " + rec[
"newFile"][i] +
" " + rec[
"oldFile"][i])
154 cmdList.append(
"cdata add " + rec[
"oldFile"][i])
156 for line
in rec[
"log"]:
162 val = input(
"update(u)/ignore(i) (defaut=u): ")
163 if val ==
'' or val ==
'u' or val ==
'U':
165 runCmd(
"; ".join(cmdList))
166 cdataSet.add(rec[
"cdataDir"])
172 for line
in list(cdataSet):
173 runCmd(
"cd " + line +
"; cdata push")
184 if rec[
"valid"]
and rec[
"failed"]:
185 for line
in rec[
"log"]:
193 parser = argparse.ArgumentParser(prog=
"cdata-log")
194 parser.add_argument(
'--version', action=
'version', version=
'%(prog)s ' + version)
195 parser.add_argument(
'--list-failed', action=
'store_true', default=
False,
196 help=
"list log of failed tests")
197 parser.add_argument(
'--local', action=
'store_true', default=
False,
198 help=
"only copy updated test files to local dir")
200 args = parser.parse_args()
202 filename =
"Testing/Temporary/LastTest.log"
204 if not os.path.exists(filename):
205 print(
"ERROR:", filename,
"does not exist")
206 print(
"ERROR: cdata-log must be run from the same directory as ctest")
212 with open(filename)
as fp:
218 if __name__ ==
"__main__":
list(APPEND LIBS ${NETCDF_LIBRARIES}) find_package(GSL REQUIRED) include_directories($
void print(std::ostream &stream, const char *format)