bug 548207 - allow make check to run over remote connection from devicemanager.py r=ted,ctalbert,jmaher

--HG--
rename : build/devicemanager.py => build/mobile/devicemanager.py
This commit is contained in:
Brad Lassey 2010-03-10 13:36:45 -05:00
parent 5ca2510cd6
commit 8857f4c08a
17 changed files with 220 additions and 13 deletions

View File

@ -85,6 +85,11 @@ DIST_GARBAGE = config.cache config.log config.status config-defs.h \
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
ifdef CROSS_COMPILE
check::
$(PYTHON) $(topsrcdir)/build/mobile/devicemanager-utils.py copy $(DIST)/bin
endif
default alldep all:: $(topsrcdir)/configure config.status
$(RM) -rf $(DIST)/sdk
$(RM) -rf $(DIST)/include

View File

@ -0,0 +1,89 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is remote test framework.
#
# The Initial Developer of the Original Code is
# the Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
import devicemanager
import sys
import os
def main():
ip_addr = os.environ.get("DEVICE_IP")
port = os.environ.get("DEVICE_PORT")
gre_path = os.environ.get("REMOTE_GRE_PATH").replace('\\','/')
if ip_addr == None:
print "Error: please define the environment variable DEVICE_IP before running this test"
sys.exit(1)
if port == None:
print "Error: please define the environment variable DEVICE_PORT before running this test"
sys.exit(1)
if gre_path == None:
print "Error: please define the environment variable REMOTE_GRE_PATH before running this test"
sys.exit(1)
dm = devicemanager.DeviceManager(ip_addr, int(port))
if len(sys.argv) < 2:
print "usage python devicemanager-run-test.py <test program> [args1 [arg2..]]"
sys.exit(1)
cmd = sys.argv[1]
args = ' '
if len(sys.argv) > 2:
args = ' ' + ' '.join(sys.argv[2:])
dm.debug = 0
lastslash = cmd.rfind('/');
if lastslash == -1:
lastslash = 0
dm.pushFile(cmd, gre_path + cmd[lastslash:])
process = dm.launchProcess([gre_path + cmd[lastslash:] + args])
output_list = dm.communicate(process)
ret = -1
if (output_list != None and output_list[0] != None):
try:
output = output_list[0]
index = output.find('exited with return code')
print output[0:index]
retstr = (output[index + 24 : output.find('\n', index)])
ret = int(retstr)
except ValueError:
ret = -1
sys.exit(ret)
if __name__ == '__main__':
main()

View File

@ -0,0 +1,88 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is remote test framework.
#
# The Initial Developer of the Original Code is
# the Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
import devicemanager
import sys
import os
def copy(dm, gre_path):
file = sys.argv[2]
if len(sys.argv) >= 4:
path = sys.argv[3]
else:
path = gre_path
if os.path.isdir(file):
dm.pushDir(file, path.replace('\\','/'))
else:
dm.pushFile(file, path.replace('\\','/'))
def delete(dm, gre_path):
file = sys.argv[2]
dm.removeFile(file)
def main():
ip_addr = os.environ.get("DEVICE_IP")
port = os.environ.get("DEVICE_PORT")
gre_path = os.environ.get("REMOTE_GRE_PATH").replace('\\','/')
if ip_addr == None:
print "Error: please define the environment variable DEVICE_IP before running this test"
sys.exit(1)
if port == None:
print "Error: please define the environment variable DEVICE_PORT before running this test"
sys.exit(1)
if gre_path == None:
print "Error: please define the environment variable REMOTE_GRE_PATH before running this test"
sys.exit(1)
dm = devicemanager.DeviceManager(ip_addr, int(port))
dm.sendCMD(['cd '+ gre_path], sleep = 1)
dm.debug = 0
if len(sys.argv) < 3:
print "usage: python devicemanager-utils.py <cmd> <path> [arg]"
cmd = sys.argv[1]
if (cmd == 'copy'):
sys.exit(copy(dm, gre_path))
if (cmd == 'delete'):
sys.exit(delete(dm, gre_path))
print "unrecognized command. supported commands are copy and delete"
sys.exit(-1)
if __name__ == '__main__':
main()

View File

@ -57,4 +57,6 @@ export::
tools::
check::
.NOTPARALLEL:

View File

@ -817,6 +817,9 @@ MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
endif
endif
ifdef CROSS_COMPILE
RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
else
ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
endif
@ -824,6 +827,7 @@ endif
ifeq ($(OS_ARCH),OS2)
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
endif
endif
#
# Java macros

View File

@ -209,7 +209,7 @@ LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
# ...and run them the usual way
check::
@$(EXIT_ON_ERROR) \
for f in $(subst .cpp,,$(CPP_UNIT_TESTS)); do \
for f in $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS)); do \
XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
done
@ -1081,7 +1081,7 @@ endif
#
$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
ifeq (WINCE,$(OS_ARCH))
$(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
$(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
else
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)

View File

@ -365,6 +365,7 @@ check-valgrind::
endif
ifdef ENABLE_TRACEJIT
ifndef CROSS_COMPILE
check::
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/trace-test/trace-test.py \
--no-slow --no-progress --tinderbox $(DIST)/bin/js$(BIN_SUFFIX)
@ -373,6 +374,7 @@ check-valgrind::
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/trace-test/trace-test.py \
--valgrind --no-slow --no-progress --tinderbox $(DIST)/bin/js$(BIN_SUFFIX)
endif
endif
DIST_GARBAGE = config.cache config.log config.status \
unallmakefiles js-config js-config.h js-confdefs.h

View File

@ -817,6 +817,9 @@ MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
endif
endif
ifdef CROSS_COMPILE
RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
else
ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
endif
@ -824,6 +827,7 @@ endif
ifeq ($(OS_ARCH),OS2)
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
endif
endif
#
# Java macros

View File

@ -209,7 +209,7 @@ LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
# ...and run them the usual way
check::
@$(EXIT_ON_ERROR) \
for f in $(subst .cpp,,$(CPP_UNIT_TESTS)); do \
for f in $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS)); do \
XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
done
@ -1081,7 +1081,7 @@ endif
#
$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
ifeq (WINCE,$(OS_ARCH))
$(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
$(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
else
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)

View File

@ -208,6 +208,6 @@ libs:: $(_TEST_FILES)
check::
@$(EXIT_ON_ERROR) \
for f in $(subst .cpp,,$(BARE_UNIT_TESTS)); do \
for f in $(subst .cpp,$(BIN_SUFFIX),$(BARE_UNIT_TESTS)); do \
$(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
done

View File

@ -75,7 +75,7 @@ endif
_HARNESS_FILES = \
$(srcdir)/runreftest.py \
automation.py \
$(topsrcdir)/build/devicemanager.py \
$(topsrcdir)/build/mobile/devicemanager.py \
$(topsrcdir)/build/automationutils.py \
$(NULL)

View File

@ -99,7 +99,7 @@ XPCSHELL_TESTS = unit
include $(topsrcdir)/config/rules.mk
check::
$(RUN_TEST_PROGRAM) $(DIST)/bin/TestCookie
$(RUN_TEST_PROGRAM) $(DIST)/bin/TestCookie$(BIN_SUFFIX)
_RES_FILES = urlparse.dat \
urlparse_unx.dat \

View File

@ -62,7 +62,7 @@ _SERV_FILES = \
runtests.py \
automation.py \
runtestsremote.py \
$(topsrcdir)/build/devicemanager.py \
$(topsrcdir)/build/mobile/devicemanager.py \
$(topsrcdir)/build/automationutils.py \
gen_template.pl \
server.js \

View File

@ -61,7 +61,7 @@ TEST_HARNESS_FILES := \
# Extra files needed from $(topsrcdir)/build
EXTRA_BUILD_FILES := \
devicemanager.py \
mobile/devicemanager.py \
automationutils.py \
$(NULL)

View File

@ -220,7 +220,7 @@ ifeq ($(OS_ARCH),OS2)
NSS_DLL_SUFFIX = .DLL
SIGN_CMD = $(MOZILLA_DIR)/toolkit/mozapps/installer/os2/sign.cmd $(DIST)
else
SIGN_CMD = $(RUN_TEST_PROGRAM) $(DIST)/bin/shlibsign -v -i
SIGN_CMD = $(RUN_TEST_PROGRAM) $(DIST)/bin/shlibsign$(BIN_SUFFIX) -v -i
endif
endif

View File

@ -184,6 +184,19 @@ endif
abs_srcdir = $(shell cd $(srcdir) && pwd)
ifdef CROSS_COMPILE
DM_RM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-utils.py delete
DM_CP = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-utils.py copy
RM_DIST = $(DM_RM)
regOrderDir=\\tests\\regorder; # This is WinCe specific, adjust for other platforms
DOCOPY=$(DM_CP) $(srcdir)/regorder $(regOrderDir)
else
DIST_PATH = $(DIST)/bin/
RM_DIST = rm -f
regOrderDir="$(call getnativepath,$(abs_srcdir)/regorder)";
DOCOPY=
endif
check::
@echo "Running XPIDL tests"
$(XPIDL_COMPILE) -m header $(srcdir)/TestScriptable.idl
@ -195,9 +208,9 @@ check::
echo "Scriptable object marked nonscriptable by xpidl"; \
exit 1; \
fi
rm -f $(DIST)/bin/components/compreg.dat; \
regOrderDir="$(call getnativepath,$(abs_srcdir)/regorder)"; \
$(RM_DIST) $(DIST_PATH)components/compreg.dat; \
$(DOCOPY) \
XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) \
$(DIST)/bin/TestRegistrationOrder$(BIN_SUFFIX) "$$regOrderDir"
$(DIST)/bin/TestRegistrationOrder$(BIN_SUFFIX) $(regOrderDir)
GARBAGE += TestScriptable.h