[tests] Replace space with colon in batch mode

This commit is contained in:
Ebrahim Byagowi 2020-04-05 22:51:58 +04:30
parent 2013babcbf
commit ba810ce83d
2 changed files with 11 additions and 13 deletions

View File

@ -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 @@ for filename in args:
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)

View File

@ -170,12 +170,15 @@ main (int argc, char **argv)
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);