• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2
3# Copyright (c) 2012 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"""
8Tests that filenames that contain colons are handled correctly.
9(This is important for absolute paths on Windows.)
10"""
11
12import os
13import sys
14
15if sys.platform == 'win32':
16  print "This test is currently disabled: https://crbug.com/483696."
17  sys.exit(0)
18
19
20import TestGyp
21
22# TODO: Make colons in filenames work with make, if required.
23test = TestGyp.TestGyp(formats=['!make'])
24CHDIR = 'colon'
25
26source_name = 'colon/a:b.c'
27copies_name = 'colon/a:b.c-d'
28if sys.platform == 'win32':
29  # Windows uses : as drive separator and doesn't allow it in regular filenames.
30  # Use abspath() to create a path that contains a colon instead.
31  abs_source = os.path.abspath('colon/file.c')
32  test.write('colon/test.gyp',
33             test.read('colon/test.gyp').replace("'a:b.c'", repr(abs_source)))
34  source_name = abs_source
35
36  abs_copies = os.path.abspath('colon/file.txt')
37  test.write('colon/test.gyp',
38             test.read('colon/test.gyp').replace("'a:b.c-d'", repr(abs_copies)))
39  copies_name = abs_copies
40
41# Create the file dynamically, Windows is unhappy if a file with a colon in
42# its name is checked in.
43test.write(source_name, 'int main() {}')
44test.write(copies_name, 'foo')
45
46test.run_gyp('test.gyp', chdir=CHDIR)
47test.build('test.gyp', test.ALL, chdir=CHDIR)
48test.built_file_must_exist(os.path.basename(copies_name), chdir=CHDIR)
49test.pass_test()
50