Chromium Code Reviews| Index: test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py |
| =================================================================== |
| --- test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py (revision 0) |
| +++ test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py (revision 0) |
| @@ -0,0 +1,40 @@ |
| +#!/usr/bin/env python |
|
borenet
2013/07/16 15:16:39
This is a rough sketch of what a test might look l
|
| + |
| +# Copyright (c) 2013 Google Inc. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +""" |
| +Test that the generator output can be written to a different drive on Windows. |
| +""" |
| + |
| +import TestGyp |
| +import subprocess |
| +import sys |
| + |
| + |
| +if sys.platform == 'win32': |
| + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
| + |
| + def GetFirstFreeDriveLetter(): |
| + """ Returns the first unused Windows drive letter in [A, Z] """ |
| + all_letters = [c for c in string.uppercase] |
| + in_use = win32api.GetLogicalDriveStrings() |
| + free = list(set(all_letters) - set(in_use)) |
| + return free[0] |
| + |
| + output_dir = os.path.join('different-drive', 'output') |
| + output_drive = GetFirstFreeDriveLetter() |
| + subprocess.call(['net', 'use', '%c:' % output_drive, |
| + '\\\\localhost\%s' % os.path.abspath(output_drive).replace(':', '$')]) |
| + try: |
| + test.run_gyp('prog.gyp', '--generator-output=%s' % ( |
| + os.path.join(output_drive, 'output'))) |
| + |
| + test.build('prog.gyp', test.ALL) |
| + test.must_exist(os.path.join(output_drive, 'output', 'Debug', |
| + 'program.exe')) |
| + |
| + test.pass_test() |
| + finally: |
| + subprocess.call(['net', 'use', '%c:' % output_drive, '/delete']) |