Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
|
borenet
2013/07/16 15:16:39
This is a rough sketch of what a test might look l
| |
| 2 | |
| 3 # Copyright (c) 2013 Google Inc. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 """ | |
| 8 Test that the generator output can be written to a different drive on Windows. | |
| 9 """ | |
| 10 | |
| 11 import TestGyp | |
| 12 import subprocess | |
| 13 import sys | |
| 14 | |
| 15 | |
| 16 if sys.platform == 'win32': | |
| 17 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) | |
| 18 | |
| 19 def GetFirstFreeDriveLetter(): | |
| 20 """ Returns the first unused Windows drive letter in [A, Z] """ | |
| 21 all_letters = [c for c in string.uppercase] | |
| 22 in_use = win32api.GetLogicalDriveStrings() | |
| 23 free = list(set(all_letters) - set(in_use)) | |
| 24 return free[0] | |
| 25 | |
| 26 output_dir = os.path.join('different-drive', 'output') | |
| 27 output_drive = GetFirstFreeDriveLetter() | |
| 28 subprocess.call(['net', 'use', '%c:' % output_drive, | |
| 29 '\\\\localhost\%s' % os.path.abspath(output_drive).replace(':', '$')]) | |
| 30 try: | |
| 31 test.run_gyp('prog.gyp', '--generator-output=%s' % ( | |
| 32 os.path.join(output_drive, 'output'))) | |
| 33 | |
| 34 test.build('prog.gyp', test.ALL) | |
| 35 test.must_exist(os.path.join(output_drive, 'output', 'Debug', | |
| 36 'program.exe')) | |
| 37 | |
| 38 test.pass_test() | |
| 39 finally: | |
| 40 subprocess.call(['net', 'use', '%c:' % output_drive, '/delete']) | |
| OLD | NEW |