show warnings in emmake and emconfigure when inputs are unexpected

This commit is contained in:
Alon Zakai 2015-01-22 15:12:16 -08:00
Родитель 917237df83
Коммит 3df48a545d
4 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -20,6 +20,17 @@ import os, sys
from tools import shared
from subprocess import CalledProcessError
if len(sys.argv) < 2 or 'configure' not in sys.argv[1]:
print >> sys.stderr, '''
emconfigure is a helper for configure, setting various environment
variables so that emcc etc. are used.
TYPICAL USAGE: emconfigure ./configure [FLAGS]
warning: you do not seem to have 'configure' as the first argument
'''
try:
shared.Building.configure(sys.argv[1:])
except CalledProcessError, e:

11
emmake
Просмотреть файл

@ -22,6 +22,17 @@ import os, sys
from tools import shared
from subprocess import CalledProcessError
if len(sys.argv) < 2 or sys.argv[1] != 'make':
print >> sys.stderr, '''
emmake is a helper for make, setting various environment
variables so that emcc etc. are used.
USAGE: emmake make [FLAGS]
warning: you do not seem to have 'make' as the first argument
'''
try:
shared.Building.make(sys.argv[1:])
except CalledProcessError, e:

Просмотреть файл

@ -4692,3 +4692,18 @@ Descriptor desc;
break
assert change > 0 and change <= n
def test_emmake_emconfigure(self):
def check(what, args, fail=True):
print what, args, fail
our, err = Popen([PYTHON, path_from_root(what)] + args, stdout=PIPE, stderr=PIPE).communicate()
assert ('is a helper for' in err) == fail
assert ('USAGE' in err) == fail
assert ('warning: you do not seem to have' in err) == fail
check('emmake', [])
check('emconfigure', [])
check('emmake', ['--version'])
check('emconfigure', ['--version'])
check('emmake', ['make'], fail=False)
check('emconfigure', ['configure'], fail=False)
check('emconfigure', ['./configure'], fail=False)

Просмотреть файл

@ -325,6 +325,7 @@ class sockets(BrowserCore):
self.btest(os.path.join('sockets', 'test_sockets_select_server_closes_connection_client_rw.c'), expected='266', args=[sockets_include, '-DSOCKK=%d' % harness.listen_port])
def test_enet(self):
# this is also a good test of raw usage of emconfigure and emmake
try_delete(self.in_dir('enet'))
shutil.copytree(path_from_root('tests', 'enet'), self.in_dir('enet'))
pwd = os.getcwd()