summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/win/generator-output-different-drive
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/python/gyp/test/win/generator-output-different-drive
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/gyp/test/win/generator-output-different-drive')
-rw-r--r--third_party/python/gyp/test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py44
-rw-r--r--third_party/python/gyp/test/win/generator-output-different-drive/prog.c10
-rw-r--r--third_party/python/gyp/test/win/generator-output-different-drive/prog.gyp15
3 files changed, 69 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py b/third_party/python/gyp/test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py
new file mode 100644
index 0000000000..96a30ec5b9
--- /dev/null
+++ b/third_party/python/gyp/test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+# 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 os
+import TestGyp
+import string
+import subprocess
+import sys
+
+
+if sys.platform == 'win32':
+ import win32api
+
+ 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.ascii_uppercase]
+ in_use = win32api.GetLogicalDriveStrings()
+ free = list(set(all_letters) - set(in_use))
+ return free[0]
+
+ output_dir = os.path.join('different-drive', 'output')
+ if not os.path.isdir(os.path.abspath(output_dir)):
+ os.makedirs(os.path.abspath(output_dir))
+ output_drive = GetFirstFreeDriveLetter()
+ subprocess.call(['subst', '%c:' % output_drive, os.path.abspath(output_dir)])
+ try:
+ test.run_gyp('prog.gyp', '--generator-output=%s' % (
+ os.path.join(output_drive, 'output')))
+ test.build('prog.gyp', test.ALL, chdir=os.path.join(output_drive, 'output'))
+ test.built_file_must_exist('program', chdir=os.path.join(output_drive,
+ 'output'),
+ type=test.EXECUTABLE)
+ test.pass_test()
+ finally:
+ subprocess.call(['subst', '%c:' % output_drive, '/D'])
diff --git a/third_party/python/gyp/test/win/generator-output-different-drive/prog.c b/third_party/python/gyp/test/win/generator-output-different-drive/prog.c
new file mode 100644
index 0000000000..7937f5d07a
--- /dev/null
+++ b/third_party/python/gyp/test/win/generator-output-different-drive/prog.c
@@ -0,0 +1,10 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdio.h>
+
+int main(void) {
+ printf("Hello from prog.c\n");
+ return 0;
+}
diff --git a/third_party/python/gyp/test/win/generator-output-different-drive/prog.gyp b/third_party/python/gyp/test/win/generator-output-different-drive/prog.gyp
new file mode 100644
index 0000000000..92f53e5da5
--- /dev/null
+++ b/third_party/python/gyp/test/win/generator-output-different-drive/prog.gyp
@@ -0,0 +1,15 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'sources': [
+ 'prog.c',
+ ],
+ },
+ ],
+}