Closed Bug 808728 Opened 8 years ago Closed 8 years ago
Android xpcshell tests do not log environment correctly
On desktop, environment variable XPCSHELL_TEST_PROFILE_DIR is set when running xpcshell during "make xpcshell-tests". On Android, it is not set when running xpcshell during "make xpcshell-tests-remote".
Actually, it turns out that XPCSHELL_TEST_PROFILE_DIR was being set. The logging was inaccurate. Here is a sample showing the problem: TEST-INFO | /home/mozdev/src/objdir-native-droid/_tests/xpcshell/netwerk/test/unit/test_simple.js | current directory: '/home/mozdev/src/objdir-native-droid/_tests/xpcshell/netwerk/test/unit' TEST-INFO | /home/mozdev/src/objdir-native-droid/_tests/xpcshell/netwerk/test/unit/test_simple.js | environment: ['XPCOM_MEM_LEAK_LOG=/data/local/tests/xpcshell/p/runxpcshelltests_leaks.log', 'NS_TRACE_MALLOC_DISABLE_STACKS=1', 'XPCOM_DEBUG_BREAK=stack-and-abort', 'MOZ_CRASHREPORTER_NO_REPORT=1', 'LD_LIBRARY_PATH=/home/mozdev/src/objdir-native-droid/netwerk/test'] This suggests that the current directory and LD_LIBRARY_PATH point to paths on the desktop - nonsense caused by logging values in the wrong place.
This patch re-arranges some code so that the env variable logging actually reflects the env vars passed to the remote system. Setting remote env vars is moved out of launchProcess and into buildEnvironment so that the env is setup in the same sequence on remote and desktop. (This causes a problem in that the leak logging environment is then automatically set up, which tickles the adb-command-line-too-long bug...so that had to be over-ridden as well.) Finally, logging the command line and environment is moved into a new function, so that the logging can be specialized in the remote case.
Comment on attachment 678500 [details] [diff] [review] log remote xpcshell environment variables correctly Review of attachment 678500 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/xpcshell/remotexpcshelltests.py @@ +215,5 @@ > > + def logCommand(self, name, completeCmd, testdir): > + self.log.info("TEST-INFO | %s | full command: %r" % (name, completeCmd)) > + self.log.info("TEST-INFO | %s | current directory: %r" % (name, self.remoteHere)) > + self.log.info("TEST-INFO | %s | environment: %s" % (name, self.env)) for desktop this is just the env vars which are changed, I believe that is all that gets printed for remote, is that true? @@ +236,5 @@ > + self.setLD_LIBRARY_PATH(self.env) > + self.env["MOZ_LINKER_CACHE"]=self.remoteBinDir > + if self.options.localAPK and self.appRoot: > + self.env["GRE_HOME"]=self.appRoot > + self.env["XPCSHELL_TEST_PROFILE_DIR"]=self.profileDir this was set before, maybe the bug title is misleading.
Attachment #678500 - Flags: review?(jmaher) → review+
(In reply to Joel Maher (:jmaher) from comment #3) > for desktop this is just the env vars which are changed, I believe that is > all that gets printed for remote, is that true? Yes, that's right. For remote, env is the set of variables that will be passed to devicemanager when launching the process. The launched process should inherit a default environment with these additional env vars set.
Summary: Android xpcshell tests do not specify XPCSHELL_TEST_PROFILE_DIR → Android xpcshell tests do not log environment correctly
Comment on attachment 678500 [details] [diff] [review] log remote xpcshell environment variables correctly OK for B2G as well.
Attachment #678500 - Flags: feedback?(mihneadb) → feedback+
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.