Bug 1340699 - Move TestAUSReadStrings into ausReadStrings.js; r?ted draft
authorMike Shal <mshal@mozilla.com>
Fri, 03 Mar 2017 10:59:51 -0500
changeset 493201 d6d2d1b1da292c75edd51265d72974e9328e9fc5
parent 482882 e1a4314f8e6eae8bbc06394c14132a9c5011371b
child 547791 1866afd559cb8223d19301fec9959032535539c2
push id47683
push userbmo:mshal@mozilla.com
push dateFri, 03 Mar 2017 16:02:46 +0000
reviewersted
bugs1340699
milestone54.0a1
Bug 1340699 - Move TestAUSReadStrings into ausReadStrings.js; r?ted This pulls the test out of 'make check' and runs it as part of xpcshell instead. MozReview-Commit-ID: 7DJAvrG7Tq1
toolkit/mozapps/update/tests/Makefile.in
toolkit/mozapps/update/tests/moz.build
toolkit/mozapps/update/tests/unit_aus_update/ausReadStrings.js
toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
--- a/toolkit/mozapps/update/tests/Makefile.in
+++ b/toolkit/mozapps/update/tests/Makefile.in
@@ -7,33 +7,11 @@ XPCSHELLTESTROOT = $(topobjdir)/_tests/x
 pp_const_file = $(srcdir)/data/xpcshellConstantsPP.js
 
 PP_TARGETS            += aus-test-const
 aus-test-const        := $(pp_const_file)
 aus-test-const_PATH   := $(XPCSHELLTESTROOT)/data
 aus-test-const_FLAGS  := -Fsubstitution $(DEFINES) $(ACDEFINES)
 aus-test-const_TARGET := misc
 
-INI_TEST_FILES = \
-  TestAUSReadStrings1.ini \
-  TestAUSReadStrings2.ini \
-  TestAUSReadStrings3.ini \
-  $(NULL)
-
 MOZ_WINCONSOLE = 1
 
 include $(topsrcdir)/config/rules.mk
-
-# TestAUSReadStrings runs during check in the following directory with a Unicode
-# char in order to test bug 473417 on Windows.
-ifeq ($(OS_ARCH),WINNT)
-bug473417dir = test_bug473417-๓
-else
-bug473417dir = test_bug473417
-endif
-
-check::
-	$(RM) -rf $(DEPTH)/_tests/updater/ && $(NSINSTALL) -D $(DEPTH)/_tests/updater/$(bug473417dir)/
-	for i in $(INI_TEST_FILES); do \
-	  $(INSTALL) $(srcdir)/$$i $(DEPTH)/_tests/updater/$(bug473417dir)/; \
-	done
-	$(INSTALL) $(FINAL_TARGET)/TestAUSReadStrings$(BIN_SUFFIX) $(DEPTH)/_tests/updater/$(bug473417dir)/
-	@$(RUN_TEST_PROGRAM) $(DEPTH)/_tests/updater/$(bug473417dir)/TestAUSReadStrings$(BIN_SUFFIX)
--- a/toolkit/mozapps/update/tests/moz.build
+++ b/toolkit/mozapps/update/tests/moz.build
@@ -98,9 +98,12 @@ FINAL_TARGET_FILES += [
     'data/partial_removed-files_mac',
     'data/partial_update_manifest',
     'data/replace_log_success',
     'data/shared.js',
     'data/sharedUpdateXML.js',
     'data/simple.mar',
     'data/wrong_product_channel.mar',
     'data/xpcshellUtilsAUS.js',
+    'TestAUSReadStrings1.ini',
+    'TestAUSReadStrings2.ini',
+    'TestAUSReadStrings3.ini',
 ]
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/update/tests/unit_aus_update/ausReadStrings.js
@@ -0,0 +1,31 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+const BIN_DIR = (IS_WIN ? "test_bug473417-รณ" : "test_bug473417")
+const BIN_EXE = "TestAUSReadStrings" + BIN_SUFFIX;
+const tempdir = do_get_tempdir();
+
+function run_test() {
+  let workdir = tempdir.clone();
+  workdir.append(BIN_DIR);
+
+  let paths = [
+    BIN_EXE,
+    "TestAUSReadStrings1.ini",
+    "TestAUSReadStrings2.ini",
+    "TestAUSReadStrings3.ini",
+  ];
+  for (let i = 0; i < paths.length; i++) {
+    let file = do_get_file("../data/" + paths[i]);
+    file.copyTo(workdir, null)
+  }
+
+  let readStrings = workdir.clone();
+  readStrings.append(BIN_EXE);
+
+  let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
+  process.init(readStrings);
+  process.run(true, [], 0);
+  do_check_eq(process.exitValue, 0);
+}
--- a/toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
+++ b/toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
@@ -1,16 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 [DEFAULT]
 tags = appupdate
 head = head_update.js
 
+[ausReadStrings.js]
 [canCheckForAndCanApplyUpdates.js]
 [urlConstruction.js]
 [updateManagerXML.js]
 [remoteUpdateXML.js]
 [downloadAndHashCheckMar.js]
 [cleanupDownloadingForOlderAppVersion.js]
 [cleanupDownloadingForDifferentChannel.js]
 [cleanupDownloadingForSameVersionAndBuildID.js]