[tests] Replace space with colon in batch mode
diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py
index 71d520f..f4fe3f4 100755
--- a/test/shaping/run-tests.py
+++ b/test/shaping/run-tests.py
@@ -1,10 +1,11 @@
#!/usr/bin/env python3
-import sys, os, subprocess, hashlib, tempfile, shutil
+import sys, os, subprocess, hashlib
def cmd(command):
+ print (command)
global process
- process.stdin.write ((' '.join (command) + '\n').encode ("utf-8"))
+ process.stdin.write ((':'.join (command) + '\n').encode ("utf-8"))
process.stdin.flush ()
return process.stdout.readline().decode ("utf-8").strip ()
@@ -97,21 +98,15 @@
print ('%s "%s" %s %s --unicodes %s' %
(hb_shape, fontfile, ' '.join(extra_options), options, unicodes))
- # hack to support fonts with space on run-tests.py, after several other tries...
- if ' ' in fontfile:
- new_fontfile = os.path.join (tempfile.gettempdir (), 'tmpfile')
- shutil.copyfile(fontfile, new_fontfile)
- fontfile = new_fontfile
-
if "--font-funcs=ft" in options and not have_freetype:
skips += 1
continue
if "--font-funcs=ot" in options or not have_freetype:
- glyphs1 = cmd ([hb_shape, "--font-funcs=ot", fontfile] + extra_options + ["--unicodes", unicodes] + options)
+ glyphs1 = cmd ([hb_shape, fontfile, "--font-funcs=ot"] + extra_options + ["--unicodes", unicodes] + options)
else:
- glyphs1 = cmd ([hb_shape, "--font-funcs=ft", fontfile] + extra_options + ["--unicodes", unicodes] + options)
- glyphs2 = cmd ([hb_shape, "--font-funcs=ot", fontfile] + extra_options + ["--unicodes", unicodes] + options)
+ glyphs1 = cmd ([hb_shape, fontfile, "--font-funcs=ft"] + extra_options + ["--unicodes", unicodes] + options)
+ glyphs2 = cmd ([hb_shape, fontfile, "--font-funcs=ot"] + extra_options + ["--unicodes", unicodes] + options)
if glyphs1 != glyphs2 and glyphs_expected != '*':
print ("FT funcs: " + glyphs1, file=sys.stderr)
diff --git a/util/hb-shape.cc b/util/hb-shape.cc
index bab5cba..78488f4 100644
--- a/util/hb-shape.cc
+++ b/util/hb-shape.cc
@@ -170,12 +170,15 @@
argc = 0;
char *p = buf, *e;
args[argc++] = p;
- while ((e = strchr (p, ' ')) && argc < (int) (int) ARRAY_LENGTH (args))
+ unsigned start_offset = 0;
+ while ((e = strchr (p + start_offset, ':')) && argc < (int) ARRAY_LENGTH (args))
{
*e++ = '\0';
- while (*e == ' ')
+ while (*e == ':')
e++;
args[argc++] = p = e;
+ /* Skip 2 first bytes on first argument if is Windows path, "C:\..." */
+ start_offset = argc == 2 && p[0] != '\0' && p[0] != ':' && p[1] == ':' && (p[2] == '\\' || p[2] == '/') ? 2 : 0;
}
ret |= driver.main (argc, args);
fflush (stdout);