bug 548207 - allow make check to run over remote connection from devicemanager.py r=ted,ctalbert,jmaher
authorBrad Lassey <blassey@mozilla.com>
Wed, 10 Mar 2010 13:36:45 -0500
changeset 39216 9a52e9c81b7033632667fab4dcb369fd719377e3
parent 39215 10d903dc22ae8ffc7addbfa7af16daca56168e2d
child 39217 316b11468cdf4d010c868766ff7d55394ab6fc4f
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, ctalbert, jmaher
bugs548207
milestone1.9.3a3pre
bug 548207 - allow make check to run over remote connection from devicemanager.py r=ted,ctalbert,jmaher
Makefile.in
build/devicemanager.py
build/mobile/devicemanager-run-test.py
build/mobile/devicemanager-utils.py
build/mobile/devicemanager.py
build/wince/tools/Makefile.in
config/config.mk
config/rules.mk
js/src/Makefile.in
js/src/config/config.mk
js/src/config/rules.mk
layout/base/tests/Makefile.in
layout/tools/reftest/Makefile.in
netwerk/test/Makefile.in
testing/mochitest/Makefile.in
testing/xpcshell/Makefile.in
toolkit/mozapps/installer/packager.mk
xpcom/tests/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
@@ -80,16 +80,21 @@ include $(topsrcdir)/config/config.mk
 
 GARBAGE_DIRS += dist _javagen _profile _tests staticlib
 DIST_GARBAGE = config.cache config.log config.status config-defs.h \
    dependencies.beos config/autoconf.mk \
    unallmakefiles mozilla-config.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
 	$(RM) -rf $(DIST)/private
 	$(RM) -rf $(DIST)/public
 	$(RM) -rf $(DIST)/bin/components
 	$(RM) -rf _tests
 
new file mode 100644
--- /dev/null
+++ b/build/mobile/devicemanager-run-test.py
@@ -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()
new file mode 100644
--- /dev/null
+++ b/build/mobile/devicemanager-utils.py
@@ -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()
rename from build/devicemanager.py
rename to build/mobile/devicemanager.py
--- a/build/wince/tools/Makefile.in
+++ b/build/wince/tools/Makefile.in
@@ -52,9 +52,11 @@ CFLAGS += -DMOZ_MEMORY
 endif
 
 include $(topsrcdir)/build/wince/tools/Makefile
 
 export::
 
 tools::
 
+check::
+
 .NOTPARALLEL:
--- a/config/config.mk
+++ b/config/config.mk
@@ -812,23 +812,27 @@ ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
 endif
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 ifdef LOCALE_MERGEDIR
 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
 
 ifeq ($(OS_ARCH),OS2)
 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
 endif
+endif
 
 #
 # Java macros
 #
 
 # Make sure any compiled classes work with at least JVM 1.4
 JAVAC_FLAGS += -source 1.4
 
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -204,17 +204,17 @@ ifdef CPP_UNIT_TESTS
 CPPSRCS += $(CPP_UNIT_TESTS)
 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 INCLUDES += -I$(DIST)/include/testing
 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
 
 endif # CPP_UNIT_TESTS
 
 .PHONY: check xpcshell-tests check-interactive check-one
 
 endif # ENABLE_TESTS
@@ -1076,17 +1076,17 @@ endif
 # in one directory, it assumes everything to compile Foo is in
 # Foo.o (from either Foo.c or Foo.cpp).
 #
 # SIMPLE_PROGRAMS = Foo Bar
 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
 #
 $(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)
 ifdef MSMANIFEST_TOOL
 	@if test -f $@.manifest; then \
 		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 		rm -f $@.manifest; \
 	fi
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -360,24 +360,26 @@ check::
 	$(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build
 
 check-valgrind::
 	$(check-sync-dirs) $(srcdir)/config $(MOZ_SYNC_BUILD_FILES)/config
 	$(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build
 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)
 
 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
 
 distclean::
 	cat unallmakefiles | $(XARGS) rm -f
 	rm -f $(DIST_GARBAGE)
 
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -812,23 +812,27 @@ ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
 endif
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 ifdef LOCALE_MERGEDIR
 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
 
 ifeq ($(OS_ARCH),OS2)
 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
 endif
+endif
 
 #
 # Java macros
 #
 
 # Make sure any compiled classes work with at least JVM 1.4
 JAVAC_FLAGS += -source 1.4
 
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -204,17 +204,17 @@ ifdef CPP_UNIT_TESTS
 CPPSRCS += $(CPP_UNIT_TESTS)
 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 INCLUDES += -I$(DIST)/include/testing
 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
 
 endif # CPP_UNIT_TESTS
 
 .PHONY: check xpcshell-tests check-interactive check-one
 
 endif # ENABLE_TESTS
@@ -1076,17 +1076,17 @@ endif
 # in one directory, it assumes everything to compile Foo is in
 # Foo.o (from either Foo.c or Foo.cpp).
 #
 # SIMPLE_PROGRAMS = Foo Bar
 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
 #
 $(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)
 ifdef MSMANIFEST_TOOL
 	@if test -f $@.manifest; then \
 		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 		rm -f $@.manifest; \
 	fi
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -203,11 +203,11 @@ ifeq (,$(filter windows,$(MOZ_WIDGET_TOO
 		$(NULL)
 endif
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
 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
--- a/layout/tools/reftest/Makefile.in
+++ b/layout/tools/reftest/Makefile.in
@@ -70,17 +70,17 @@ make-xpi:
 	+$(MAKE) -C $(CURDIR) libs XPI_NAME=reftest
 copy-harness: make-xpi
 libs:: copy-harness
 endif
 
 _HARNESS_FILES = \
   $(srcdir)/runreftest.py \
   automation.py \
-  $(topsrcdir)/build/devicemanager.py \
+  $(topsrcdir)/build/mobile/devicemanager.py \
   $(topsrcdir)/build/automationutils.py \
   $(NULL)
 
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@
 
 $(_HARNESS_FILES): $(_DEST_DIR)
 
--- a/netwerk/test/Makefile.in
+++ b/netwerk/test/Makefile.in
@@ -94,17 +94,17 @@ LIBS		= $(EXTRA_DSO_LIBS) \
 
 DEFINES += $(TK_CFLAGS)
 
 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 \
 		  $(NULL)
 libs:: $(_RES_FILES)
 	$(INSTALL) $^ $(DIST)/bin/res
 install:: $(_RES_FILES)
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/res
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -57,17 +57,17 @@ include $(topsrcdir)/config/rules.mk
 TARGET_DEPTH = ../../..
 include $(topsrcdir)/build/automation-build.mk
 
 # files that get copied into $objdir/_tests/
 _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 \
 		harness-a11y.xul \
 		harness-overlay.xul \
 		harness.xul \
 		browser-test-overlay.xul \
 		browser-test.js \
--- a/testing/xpcshell/Makefile.in
+++ b/testing/xpcshell/Makefile.in
@@ -56,17 +56,17 @@ include $(topsrcdir)/config/rules.mk
 # Harness files from the srcdir
 TEST_HARNESS_FILES := \
   runxpcshelltests.py \
   head.js \
   $(NULL)
 
 # Extra files needed from $(topsrcdir)/build
 EXTRA_BUILD_FILES := \
-  devicemanager.py \
+  mobile/devicemanager.py \
   automationutils.py \
   $(NULL)
 
 # Components / typelibs that don't get packaged with
 # the build, but that we need for the test harness.
 TEST_HARNESS_COMPONENTS := \
   httpd.js \
   $(NULL)
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -215,17 +215,17 @@ NATIVE_ARCH	= $(shell uname -p | sed -e 
 NATIVE_DIST	= $(DIST:$(DEPTH)/%=$(DEPTH)/../$(NATIVE_ARCH)/%)
 SIGN_CMD	= $(NATIVE_DIST)/bin/run-mozilla.sh $(NATIVE_DIST)/bin/shlibsign -v -i
 else
 ifeq ($(OS_ARCH),OS2)
 # uppercase extension to get the correct output file from shlibsign
 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
 
 SOFTOKN		= $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)softokn3$(NSS_DLL_SUFFIX)
 NSSDBM		= $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)nssdbm3$(NSS_DLL_SUFFIX)
 FREEBL		= $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl3$(NSS_DLL_SUFFIX)
 FREEBL_32FPU	= $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl_32fpu_3$(DLL_SUFFIX)
 FREEBL_32INT	= $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl_32int_3$(DLL_SUFFIX)
--- a/xpcom/tests/Makefile.in
+++ b/xpcom/tests/Makefile.in
@@ -179,25 +179,38 @@ ifeq (,$(filter-out WINNT WINCE os2-emx,
 swapslashes = $(shell echo $(1) | sed -e 's|/|\\|g')
 getnativepath = $(call swapslashes,$(call normalizepath,$(1)))
 else
 getnativepath = $(1)
 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
 	@if grep Notscriptable TestScriptable.h | grep -q NS_SCRIPTABLE ; then \
 		echo "Nonscriptable object marked scriptable by xpidl"; \
 		exit 1; \
 	fi
 	@if test $$( grep 'NS_IMETHOD[^I].*Scriptable' TestScriptable.h | grep -v -c NS_SCRIPTABLE ) != 0 ; then \
 		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