Expand testing of necessary features for print-changed=dot-cfg.
authorJamie Schmeiser <schmeise@ca.ibm.com>
Thu, 2 Dec 2021 13:16:18 +0000 (08:16 -0500)
committerJamie Schmeiser <schmeise@ca.ibm.com>
Thu, 2 Dec 2021 13:16:18 +0000 (08:16 -0500)
Summary:
Expand the testing for whether the lit tests for print-changed=dot-cfg
are supported to include checking whether dot supports pdf output.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: hvdijk (Harald van Dijk)
Differential Revision: https://reviews.llvm.org/D113187

llvm/test/Other/ChangePrinters/DotCfg/lit.local.cfg

index a739faf..73913bb 100644 (file)
@@ -1,4 +1,20 @@
 import os
+import subprocess
 
-if not os.path.exists('/usr/bin/dot'):
+def have_needed_dot_support():
+  if not os.path.exists('/usr/bin/dot'):
+    return False
+
+  try:
+    ld_cmd = subprocess.Popen(['/usr/bin/dot', '-T?'],
+                              stdout=subprocess.PIPE,
+                              stderr=subprocess.PIPE)
+    ld_err = ld_cmd.stderr.read().decode()
+    ld_cmd.wait()
+  except:
+    return False
+
+  return 'pdf' in ld_err
+
+if not have_needed_dot_support():
   config.unsupported = True