From: Quentin Schulz <quentin.sch...@cherry.de>

This allows to pass a patch via stdin to patchtest.
This will be useful when using b4 with patchtest, with the former
passing each patch to the latter via stdin.

Signed-off-by: Quentin Schulz <quentin.sch...@cherry.de>
---
 scripts/patchtest | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/patchtest b/scripts/patchtest
index 
bcd48dbcc39573d7abd3247bc34cb9ac8a8a5c2e..66a9f6470ca860c2233fb9ace042edf4b4737c88
 100755
--- a/scripts/patchtest
+++ b/scripts/patchtest
@@ -205,11 +205,20 @@ def main():
         patch_list = [patch_path]
 
     for patch in patch_list:
-        if os.path.getsize(patch) == 0:
+        if patch == "-":
+            import tempfile
+
+            patch = tempfile.NamedTemporaryFile(delete=False)
+            patch.write(sys.stdin.buffer.read())
+            patch.flush()
+            logger.info('Testing patch from stdin')
+            tmp_patch = True
+            patch = patch.name
+        elif os.path.getsize(patch) == 0:
             logger.error('patchtest: patch is empty')
             return 1
-
-        logger.info('Testing patch %s' % patch)
+        else:
+            logger.info('Testing patch %s' % patch)
 
         if log_results:
             log_path = patch + ".testresult"

-- 
2.48.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210661): 
https://lists.openembedded.org/g/openembedded-core/message/210661
Mute This Topic: https://lists.openembedded.org/mt/110973476/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to