Changeset 8565a42 in mainline for tools/checkers/clang.py
- Timestamp:
- 2018-03-02T20:34:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1a81f69, d5e5fd1
- Parents:
- 3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
- git-committer:
- GitHub <noreply@…> (2018-03-02 20:34:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/checkers/clang.py
r3061bc1 r8565a42 46 46 def clang(root, job): 47 47 "Run Clang on a jobfile" 48 48 49 49 inname = os.path.join(root, job) 50 50 51 51 if (not os.path.isfile(inname)): 52 52 print("Unable to open %s" % inname) 53 53 print("Did you run \"make precheck\" on the source tree?") 54 54 return False 55 55 56 56 inf = open(inname, "r") 57 57 records = inf.read().splitlines() 58 58 inf.close() 59 59 60 60 for record in records: 61 61 arg = jobfile.parse_arg(record) 62 62 if (not arg): 63 63 return False 64 64 65 65 if (len(arg) < 6): 66 66 print("Not enough jobfile record arguments") 67 67 return False 68 68 69 69 srcfname = arg[0] 70 70 tgtfname = arg[1] … … 73 73 base = arg[4] 74 74 options = arg[5].split() 75 75 76 76 srcfqname = os.path.join(base, srcfname) 77 77 if (not os.path.isfile(srcfqname)): 78 78 print("Source %s not found" % srcfqname) 79 79 return False 80 80 81 81 # Only C files are interesting for us 82 82 if (tool != "cc"): 83 83 continue 84 84 85 85 args = ['clang', '-Qunused-arguments', '--analyze', 86 86 '-Xanalyzer', '-analyzer-opt-analyze-headers', … … 88 88 args.extend(options) 89 89 args.extend(['-o', tgtfname, srcfname]) 90 90 91 91 cwd = os.getcwd() 92 92 os.chdir(base) 93 93 retval = subprocess.Popen(args).wait() 94 94 os.chdir(cwd) 95 95 96 96 if (retval != 0): 97 97 return False 98 98 99 99 return True 100 100 … … 103 103 usage(sys.argv[0]) 104 104 return 105 105 106 106 rootdir = os.path.abspath(sys.argv[1]) 107 107 config = os.path.join(rootdir, "HelenOS.config") 108 108 109 109 if (not os.path.isfile(config)): 110 110 print("%s not found." % config) 111 111 print("Please specify the path to HelenOS build tree root as the first argument.") 112 112 return 113 113 114 114 for job in jobs: 115 115 if (not clang(rootdir, job)): … … 117 117 print("Failed job: %s" % job) 118 118 return 119 119 120 120 print 121 121 print("All jobs passed")
Note:
See TracChangeset
for help on using the changeset viewer.