Add a test for very-long-filename support. NFC
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 62868e9..bee843e 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -315,59 +315,6 @@
- test-bazel-windows
workflows:
- lint:
- jobs:
- - lint
- test-linux:
- jobs:
- - test-linux
- test-linux-arm64:
- jobs:
- - test-linux-arm64
- test-mac-arm64:
- jobs:
- - test-mac-arm64
test-windows:
jobs:
- test-windows
- build-docker-image:
- jobs:
- - build-docker-image-x64
- - publish-docker-image-x64:
- filters:
- branches:
- ignore: /.*/
- tags:
- only: /.*/
- - publish-docker-image-arm64:
- filters:
- branches:
- ignore: /.*/
- tags:
- only: /.*/
- - publish-docker-image-multiplatform:
- filters:
- tags:
- only: /.*/
- requires:
- - publish-docker-image-x64
- - publish-docker-image-arm64
-
- test-bazel7-linux:
- jobs:
- - test-bazel7-linux
- test-bazel-latest-linux:
- jobs:
- - test-bazel-latest-linux
- test-bazel7-mac-arm64:
- jobs:
- - test-bazel7-mac-arm64
- test-bazel-latest-mac-arm64:
- jobs:
- - test-bazel-latest-mac-arm64
- test-bazel7-windows:
- jobs:
- - test-bazel7-windows
- test-bazel-latest-windows:
- jobs:
- - test-bazel-latest-windows
diff --git a/emsdk.py b/emsdk.py
index abdfbbc..8ba883a 100644
--- a/emsdk.py
+++ b/emsdk.py
@@ -524,6 +524,8 @@
# See https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath and http://stackoverflow.com/questions/3555527/python-win32-filename-length-workaround
# In that mode, forward slashes cannot be used as delimiters.
def fix_potentially_long_windows_pathname(pathname):
+ # DO NOT SUBMIT: testing
+ #return pathname
if not WINDOWS or MSYS:
return pathname
# Test if emsdk calls fix_potentially_long_windows_pathname() with long
diff --git a/test/test.py b/test/test.py
index a1b871c..eaba58f 100755
--- a/test/test.py
+++ b/test/test.py
@@ -32,6 +32,12 @@
return [x]
+def copy_emsdk_to(targetdir):
+ for filename in os.listdir('.'):
+ if not filename.startswith('.') and not os.path.isdir(filename):
+ shutil.copy2(filename, os.path.join(targetdir, filename))
+
+
def check_call(cmd, **kwargs):
if type(cmd) is not list:
cmd = cmd.split()
@@ -137,6 +143,35 @@
run_emsdk('install latest')
run_emsdk('activate latest')
+ def test_extrememly_long_filenames(self):
+ # We have special support for filenames longer than 256 on windows. This
+ # test installs emsdk in path that exceeds this limit in order to test
+ # this handling.
+ longpath = 'very_long_filename_indeed'
+ while len(longpath) < 256:
+ longpath = os.path.join(longpath, longpath)
+
+ if WINDOWS:
+ longpath = '\\\\?\\' + os.path.abspath(longpath)
+
+ os.makedirs(longpath, exist_ok=True)
+ copy_emsdk_to(longpath)
+
+ emsdk = os.path.join(longpath, 'emsdk')
+ if WINDOWS:
+ emsdk += '.bat'
+ print(emsdk)
+ self.assertTrue(os.path.exists(emsdk))
+
+ check_call([emsdk, 'install', 'latest'])
+ check_call([emsdk, 'activate', 'latest'])
+
+ emcc = os.path.join(longpath, 'upstream', 'emscripten', 'emcc')
+ print(emcc)
+ self.assertTrue(os.path.exists(emcc))
+
+ check_call([emcc, 'hello_world.c'])
+
def test_unknown_arch(self):
env = os.environ.copy()
env['EMSDK_ARCH'] = 'mips'
@@ -236,9 +271,7 @@
print('test non-git update')
temp_dir = tempfile.mkdtemp()
- for filename in os.listdir('.'):
- if not filename.startswith('.') and not os.path.isdir(filename):
- shutil.copy2(filename, os.path.join(temp_dir, filename))
+ copy_emsdk_to(temp_dir)
olddir = os.getcwd()
try:
@@ -278,4 +311,4 @@
if __name__ == '__main__':
- unittest.main(verbosity=2)
+ unittest.main(verbosity=2, failfast=True)