xref: /llvm-project/llvm/test/CodeGen/PowerPC/lit.local.cfg (revision d9db2664994ff672f50d7fd0117477935dac04f1)
1if not "PowerPC" in config.root.targets:
2    config.unsupported = True
3
4import subprocess
5
6config.suffixes.add(".py")
7
8def get_revision(repo_path):
9    cmd = ['git', '-C', repo_path, 'rev-parse', 'HEAD']
10    try:
11        return subprocess.run(cmd, stdout=subprocess.PIPE, check=True).stdout.decode()
12    except Exception as e:
13        print("An error occurred retrieving the git revision:", e)
14        return None
15
16if config.have_vc_rev:
17    if config.force_vc_rev:
18        git_revision = config.force_vc_rev
19    else:
20        git_revision = get_revision(config.llvm_src_root)
21    if git_revision:
22        config.substitutions.append(("git-revision", git_revision))
23        config.available_features.add("vc-rev-enabled")
24