buildbot: Cleanup simulators after running tests
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 20:07:28 +0000 (20:07 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 20:07:28 +0000 (20:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171679

Reviewed by Aakash Jain.

simctl is partitioned for each user. Since kill-old-processes
is run as root, we need to specify the buildbot user when tearing
down simulators between steps.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(KillOldProcesses): Pass buildbot user to kill-old-processes.
* BuildSlaveSupport/kill-old-processes:
(main): Specify the user for simctl if one has been provided.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216447 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg
Tools/BuildSlaveSupport/kill-old-processes
Tools/ChangeLog

index 4ce1e67..e9967e2 100644 (file)
@@ -150,7 +150,7 @@ class KillOldProcesses(shell.Compile):
     name = "kill old processes"
     description = ["killing old processes"]
     descriptionDone = ["killed old processes"]
-    command = ["python", "./Tools/BuildSlaveSupport/kill-old-processes"]
+    command = ["python", "./Tools/BuildSlaveSupport/kill-old-processes", "buildbot"]
 
 class CleanBuildIfScheduled(shell.Compile):
     name = "delete WebKitBuild directory"
index a9d6944..c0a683a 100755 (executable)
@@ -26,7 +26,7 @@
 import os, sys
 
 
-def main():
+def main(user=None):
     tasksToKillWin = [
         "cl.exe",
         "devenv.com",
@@ -113,7 +113,10 @@ def main():
         for task in tasksToKill + tasksToKillMac:
             os.system("killall -9 -v -m " + task)
         # Shutdown any simulators
-        os.system("xcrun simctl shutdown booted")
+        if os.geteuid() == 0 and user:
+            os.system("sudo -u {} xcrun simctl shutdown booted".format(user))
+        else:
+            os.system("xcrun simctl shutdown booted")
         # Kill all instances of python executing run-webkit-tests
         os.system("ps aux | grep -E '.+/Python .+(run_webkit_tests|run-webkit-tests|mod_pywebsocket)' | grep -v grep | awk '{print $2}' | xargs kill")
     elif sys.platform == 'cygwin' or sys.platform == 'win32':
@@ -129,4 +132,5 @@ def main():
 
 
 if __name__ == '__main__':
-    sys.exit(main())
+    user = sys.argv[1] if len(sys.argv) > 1 else None
+    sys.exit(main(user))
index 69be54b..213cb44 100644 (file)
@@ -1,3 +1,19 @@
+2017-05-08  Jonathan Bedard  <jbedard@apple.com>
+
+        buildbot: Cleanup simulators after running tests
+        https://bugs.webkit.org/show_bug.cgi?id=171679
+
+        Reviewed by Aakash Jain.
+
+        simctl is partitioned for each user. Since kill-old-processes
+        is run as root, we need to specify the buildbot user when tearing
+        down simulators between steps.
+
+        * BuildSlaveSupport/build.webkit.org-config/master.cfg:
+        (KillOldProcesses): Pass buildbot user to kill-old-processes.
+        * BuildSlaveSupport/kill-old-processes:
+        (main): Specify the user for simctl if one has been provided.
+
 2017-05-08  Carlos Alberto Lopez Perez  <clopez@igalia.com>
 
         REGRESSION(r216179): [GTK] Script install-dependencies misses liborc