You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2022/07/22 09:01:03 UTC

[plc4x] 02/02: fix(plc4j): Made the ParserSerializerTestsuiteGeneratorSpec.groovy check if it uses the Apple pre 1.10.0 libpcap version and skip the test, if it does

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit bb923aff2b1f5d95315a6f19c268b395c975cbe6
Author: christoferdutz <ch...@c-ware.de>
AuthorDate: Fri Jul 22 11:00:53 2022 +0200

    fix(plc4j): Made the ParserSerializerTestsuiteGeneratorSpec.groovy check if it uses the Apple pre 1.10.0 libpcap version and skip the test, if it does
---
 .../ParserSerializerTestsuiteGeneratorSpec.groovy    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/plc4j/utils/test-generator/src/test/groovy/org/apache/plc4x/test/generator/ParserSerializerTestsuiteGeneratorSpec.groovy b/plc4j/utils/test-generator/src/test/groovy/org/apache/plc4x/test/generator/ParserSerializerTestsuiteGeneratorSpec.groovy
index 9a0a8e206..fb6295a08 100644
--- a/plc4j/utils/test-generator/src/test/groovy/org/apache/plc4x/test/generator/ParserSerializerTestsuiteGeneratorSpec.groovy
+++ b/plc4j/utils/test-generator/src/test/groovy/org/apache/plc4x/test/generator/ParserSerializerTestsuiteGeneratorSpec.groovy
@@ -40,6 +40,26 @@ class ParserSerializerTestsuiteGeneratorSpec extends Specification {
         } catch (e) {
             throw new TestAbortedException("no tshark", e)
         }
+        // On macs the libpcap version installed is usually 1.9.x
+        // This causes errors. We therefore need to skip this test on such devices.
+        try {
+            def sout = new StringBuilder(), serr = new StringBuilder()
+            def proc = "tcpdump --version".execute()
+            proc.consumeProcessOutput(sout, serr)
+            proc.waitForOrKill(1000)
+            def output = serr + sout
+            if(!output.contains("libpcap")) {
+                throw new TestAbortedException("no libpcap")
+            }
+            def libpcapVersion = output.substring(output.indexOf("libpcap version ") + 16)
+            libpcapVersion = libpcapVersion.substring(0, libpcapVersion.indexOf("\n"))
+            // Check the libpcapVersion is at least 1.10.0
+            if(!libpcapVersion.startsWith("1.10")) {
+                throw new TestAbortedException("minimum libpcap version 1.10.0 expected")
+            }
+        } catch (e) {
+            throw new TestAbortedException("no tcpdump", e)
+        }
         if (!new File('/bin/sh').canExecute()) throw new TestAbortedException("No bin sh")
         def testSuitePath = Files.createTempFile("parser-serializer-testsuite", ".xml")
         URL pcap = ParserSerializerTestsuiteGeneratorSpec.getResource("/bacnet-stack-services.cap");