For Windows machines, save binaries with '.exe' extension

This commit is contained in:
Andrew Grant committed 2020-04-21 06:41:10 -04:00
1 parent ac58820d1b
commit 10cf785779
1 file changed
+16 -5
+16 -5
View File
@@ -155,6 +155,7 @@ def getEngine(data, engine):
# Move the binary to the /Engines/ directory # Move the binary to the /Engines/ directory
output = '{0}{1}'.format(pathway, engine['name']) output = '{0}{1}'.format(pathway, engine['name'])
destination = 'Engines/{0}'.format(engine['sha']) destination = 'Engines/{0}'.format(engine['sha'])
if IS_WINDOWS: destination += '.exe'
# Check to see if the compiler included a file extension or not # Check to see if the compiler included a file extension or not
if os.path.isfile(output): os.rename(output, destination) if os.path.isfile(output): os.rename(output, destination)
@@ -175,6 +176,12 @@ def getCutechessCommand(arguments, data, nps):
basethreads = int(tokens[0].split('=')[1]) basethreads = int(tokens[0].split('=')[1])
baseoptions = ' option.'.join(['']+tokens) baseoptions = ' option.'.join(['']+tokens)
# Ensure .exe extension on Windows
devCommand = data['test']['dev']['sha']
if IS_WINDOWS: devCommand += '.exe'
baseCommand = data['test']['base']['sha']
if IS_WINDOWS: baseCommand += '.exe'
# Scale the time control for this machine's speed # Scale the time control for this machine's speed
timecontrol = computeAdjustedTimecontrol(arguments, data, nps) timecontrol = computeAdjustedTimecontrol(arguments, data, nps)
@@ -198,14 +205,14 @@ def getCutechessCommand(arguments, data, nps):
# Options for the Dev Engine # Options for the Dev Engine
devflags = '-engine dir=Engines/ cmd=./{0} proto={1} tc={2}{3} name={4}'.format( devflags = '-engine dir=Engines/ cmd=./{0} proto={1} tc={2}{3} name={4}'.format(
data['test']['dev']['sha'], data['test']['dev']['protocol'], timecontrol, devCommand, data['test']['dev']['protocol'], timecontrol, devoptions,
devoptions, '{0}-{1}'.format(data['test']['engine'], data['test']['dev']['sha'][:8]) '{0}-{1}'.format(data['test']['engine'], data['test']['dev']['sha'][:8])
) )
# Options for the Base Engine # Options for the Base Engine
baseflags = '-engine dir=Engines/ cmd=./{0} proto={1} tc={2}{3} name={4}'.format( baseflags = '-engine dir=Engines/ cmd=./{0} proto={1} tc={2}{3} name={4}'.format(
data['test']['base']['sha'], data['test']['base']['protocol'], timecontrol, baseCommand, data['test']['base']['protocol'], timecontrol, baseoptions,
baseoptions, '{0}-{1}'.format(data['test']['engine'], data['test']['base']['sha'][:8]) '{0}-{1}'.format(data['test']['engine'], data['test']['base']['sha'][:8])
) )
# Options for opening selection # Options for opening selection
@@ -256,8 +263,12 @@ def parseStreamOutput(output):
def computeSingleThreadedBenchmark(engine, outqueue): def computeSingleThreadedBenchmark(engine, outqueue):
try: try:
# Launch the engine and run a benchmark
# Ensure .exe for Windows and correct path
if IS_WINDOWS: engine += '.exe'
dir = os.path.join('Engines', engine) dir = os.path.join('Engines', engine)
# Launch the engine and run a benchmark
stdout, stderr = subprocess.Popen( stdout, stderr = subprocess.Popen(
'./{0} bench'.format(dir).split(), './{0} bench'.format(dir).split(),
stdout=subprocess.PIPE, stdout=subprocess.PIPE,