OSDN Git Service

add irun (interactive run)
authorZach Johnson <zachoverflow@google.com>
Thu, 4 Feb 2021 22:05:52 +0000 (14:05 -0800)
committerZach Johnson <zachoverflow@google.com>
Thu, 4 Feb 2021 22:09:00 +0000 (14:09 -0800)
fire up your command list of test(s) you want to iterate on

will run to completion, and when there are changes it will rerun

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/irun --rhost
Change-Id: Ic067f70e00740bc5588bdd8b9ac334e834fdb238

gd/cert/change_waiter.py [new file with mode: 0644]
gd/cert/irun [new file with mode: 0755]

diff --git a/gd/cert/change_waiter.py b/gd/cert/change_waiter.py
new file mode 100644 (file)
index 0000000..30a72f9
--- /dev/null
@@ -0,0 +1,18 @@
+import pyinotify
+import sys
+
+wm = pyinotify.WatchManager()
+mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY
+
+
+class EventHandler(pyinotify.ProcessEvent):
+
+    def process_default(self, event):
+        quit()
+
+
+handler = EventHandler()
+notifier = pyinotify.Notifier(wm, handler)
+wdd = wm.add_watch(sys.argv[1], mask, rec=True)
+
+notifier.loop()
diff --git a/gd/cert/irun b/gd/cert/irun
new file mode 100755 (executable)
index 0000000..30ab877
--- /dev/null
@@ -0,0 +1,10 @@
+#! /bin/bash
+# interactive version of run
+
+trap "exit;" SIGINT SIGTERM
+
+while true
+do
+    ${ANDROID_BUILD_TOP}/system/bt/gd/cert/run "$@"
+    python3 ${ANDROID_BUILD_TOP}/system/bt/gd/cert/change_waiter.py ${ANDROID_BUILD_TOP}/system/bt
+done