comparison tests/run-tests.py @ 19242:d25fc3264d44

run-tests: pull hgrc creation out as function
author Matt Mackall <mpm@selenic.com>
date Fri, 24 May 2013 13:41:20 -0500
parents a32986dea31a
children 050c6fae40d2
comparison
equal deleted inserted replaced
19241:a32986dea31a 19242:d25fc3264d44
325 name = os.path.join(p, program) 325 name = os.path.join(p, program)
326 if os.name == 'nt' or os.access(name, os.X_OK): 326 if os.name == 'nt' or os.access(name, os.X_OK):
327 return name 327 return name
328 return None 328 return None
329 329
330 def createhgrc(path, options):
331 # create a fresh hgrc
332 hgrc = open(path, 'w+')
333 hgrc.write('[ui]\n')
334 hgrc.write('slash = True\n')
335 hgrc.write('interactive = False\n')
336 hgrc.write('[defaults]\n')
337 hgrc.write('backout = -d "0 0"\n')
338 hgrc.write('commit = -d "0 0"\n')
339 hgrc.write('tag = -d "0 0"\n')
340 if options.inotify:
341 hgrc.write('[extensions]\n')
342 hgrc.write('inotify=\n')
343 hgrc.write('[inotify]\n')
344 hgrc.write('pidfile=%s\n' % DAEMON_PIDS)
345 hgrc.write('appendpid=True\n')
346 if options.extra_config_opt:
347 for opt in options.extra_config_opt:
348 section, key = opt.split('.', 1)
349 assert '=' in key, ('extra config opt %s must '
350 'have an = for assignment' % opt)
351 hgrc.write('[%s]\n%s\n' % (section, key))
352 hgrc.close()
353
354
330 def checktools(): 355 def checktools():
331 # Before we go any further, check for pre-requisite tools 356 # Before we go any further, check for pre-requisite tools
332 # stuff from coreutils (cat, rm, etc) are not tested 357 # stuff from coreutils (cat, rm, etc) are not tested
333 for p in requiredtools: 358 for p in requiredtools:
334 if os.name == 'nt' and not p.endswith('.exe'): 359 if os.name == 'nt' and not p.endswith('.exe'):
873 ignore("doesn't match keyword") 898 ignore("doesn't match keyword")
874 return None 899 return None
875 900
876 vlog("# Test", test) 901 vlog("# Test", test)
877 902
878 # create a fresh hgrc 903 createhgrc(HGRCPATH, options)
879 hgrc = open(HGRCPATH, 'w+')
880 hgrc.write('[ui]\n')
881 hgrc.write('slash = True\n')
882 hgrc.write('interactive = False\n')
883 hgrc.write('[defaults]\n')
884 hgrc.write('backout = -d "0 0"\n')
885 hgrc.write('commit = -d "0 0"\n')
886 hgrc.write('tag = -d "0 0"\n')
887 if options.inotify:
888 hgrc.write('[extensions]\n')
889 hgrc.write('inotify=\n')
890 hgrc.write('[inotify]\n')
891 hgrc.write('pidfile=%s\n' % DAEMON_PIDS)
892 hgrc.write('appendpid=True\n')
893 if options.extra_config_opt:
894 for opt in options.extra_config_opt:
895 section, key = opt.split('.', 1)
896 assert '=' in key, ('extra config opt %s must '
897 'have an = for assignment' % opt)
898 hgrc.write('[%s]\n%s\n' % (section, key))
899 hgrc.close()
900 904
901 err = os.path.join(TESTDIR, test+".err") 905 err = os.path.join(TESTDIR, test+".err")
902 if os.path.exists(err): 906 if os.path.exists(err):
903 os.remove(err) # Remove any previous output files 907 os.remove(err) # Remove any previous output files
904 lctest = test.lower() 908 lctest = test.lower()