Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: robertmaynard/DependsTester
base: cbe472e3e8
head fork: robertmaynard/DependsTester
compare: 940dc022a0
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 55 additions and 38 deletions.
  1. +6 −4 README
  2. +2 −0  Testing/test.bat
  3. +47 −34
@@ -7,10 +7,12 @@ The python script runs the passed in application and does a full profiling
on all the dependencies and than verfies that nothing was missing.
Usage: -d dependsTest.exe -a appTest.exe -g "--appArg1 4 --randomArg2 12" dependsTest.exe appTest.exe --appArg1 4 --randomArg2 12
--d --depends the path to dependency walker
--a --application the path to the application to test
--g --application arguments, needs to be a string of arguments like: "-a -f foo"
+First Argument: Path to dependency walker
+Second Argument: Path to application to profile
+--envPath: Extra paths to add to the enviornment.
+All other arguments are passed through as arguments to the application to test
2  Testing/test.bat
@@ -0,0 +1,2 @@
+call ..\ --envpath D:/Qt/qt-4.8.0x64/bin D:/Depends/depends.exe D:/Work/ParaView/build/bin/Debug/paraview.exe --exit
@@ -4,31 +4,42 @@
# PURPOSE. See the above copyright notice for more information.
-import fileinput, glob, string, sys, os, re, argparse, tempfile
+import fileinput, glob, string, sys, os, re, argparse, tempfile, subprocess
# -c console mode
+# -f full paths
# -pa:1 turn on ALL profiling options
# -pb automatically start profiling after depends opens
#we will add on the -oc: argument to specify the path to the output file
-dependsArgs = "-c -pa:1 -pb"
-dependsOutputArg = "-oc:"
+dependsArgs = ["-c", "-f1","-pa1","-pb"]
+dependsOutputArg = "-oc"
dependsFileHandle = None
+#makes the path a window path if it isn't already
+def makeWindowsPath(path):
+ return os.path.abspath(path)
def generateTempFile():
dependsFileHandle = handle
+ filePath = makeWindowsPath(filePath)
return filePath
#builds the string to be used to launch dependency walker
def buildDependsCommandString(dependsPath,appPath,appArgs):
#no space between oc: and path
- outputArg = ''.join([dependsOutputArg,generateTempFile()])
+ tempFile = '"'+generateTempFile()+'"'
+ outputArg = ' '.join([dependsOutputArg,tempFile])
+ dependsArgs.append(outputArg)
+ dependsArgs.append(appPath)
#flatten the list into a string
- flattenedAppArgs = ' '.join(appArgs)
- #generate the final string needed to run dependency walker
- finalString = ' '.join([dependsPath,dependsArgs,outputArg,appPath,flattenedAppArgs])
- return finalString
+ if(appArgs):
+ flattenedAppArgs = ' '.join(appArgs)
+ dependsArgs.append(flattenedAppArgs)
+ flatArgs = ' '.join(dependsArgs)
+ return dependsPath+" "+flatArgs
#verfies that a file exists and is an executable
def isExecutable(execPath):
@@ -41,46 +52,48 @@ def isExecutable(execPath):
raise IOError
return True
-#makes sure two paths aren't the same
-def areSame(path1,path2):
- if(os.path.samefile(path1,path2)):
- raise IOError
#launches dependency walker
def launchDepends(depends,application,appArgs):
- print buildDependsCommandString(depends,application,appArgs)
+ command = buildDependsCommandString(depends,application,appArgs)
+ print "dependency command is: ", command
+ result =,shell=True)
+ return result
+#adds the list of paths in envpath to the system path variable
+#before we launch dependency walker
+def addPaths(envpath):
+ if(envpath):
+ os.environ['PATH']=os.environ['PATH']+';'+envpath
+#parses the temp file with the results of the run
+def parseResults():
+ for line in open(dependsFileHandle):
+ print line
def main():
#arguments we need. Path to Depends
#path to application, arguments for application
parser = argparse.ArgumentParser(description='profile an application with dependency walker')
- parser.add_argument('-d', '--depends',
- required=True,
- help='path to dependency walker')
- parser.add_argument('-a', '--application',
- required=True,
- help='path to application to test')
- parser.add_argument('-g','--applicationArguments',
- dest='appArgs',
- nargs='+',
- help='stores all the application arguments')
- args = parser.parse_args()
- #make sure args is an empty list instead of none
- if (args.appArgs is None):
- args.appArgs = []
+ parser.add_argument('--envpath',
+ help='add paths to the system path')
+ parser.add_argument("depends", help='path to dependency walker')
+ parser.add_argument(dest="application", help='path to application to test')
+ args,appArgs = parser.parse_known_args()
+ args.depends = makeWindowsPath(args.depends)
+ args.application = makeWindowsPath(args.application)
- areSame(args.depends,args.application)
except IOError:
- print("Unable to launch depends because of invalid paths")
+ print("Unable to launch depends because of invalid executable paths")
- launchDepends(args.depends,args.application,args.appArgs)
+ addPaths(args.envpath)
+ result = launchDepends(args.depends,args.application,appArgs)
+ if(result):
+ parseResults()
if __name__ == '__main__':

No commit comments for this range

Something went wrong with that request. Please try again.