diff --git a/llvm/test/Other/ChangePrinters/DotCfg/lit.local.cfg b/llvm/test/Other/ChangePrinters/DotCfg/lit.local.cfg index a739faf919daa..73913bb97a72a 100644 --- a/llvm/test/Other/ChangePrinters/DotCfg/lit.local.cfg +++ b/llvm/test/Other/ChangePrinters/DotCfg/lit.local.cfg @@ -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