Debian Codegraph @

libcxx/test/selftest/dsl/lit.local.cfg

raw symbols SCIP
1 # Since we try to pass substitutions as-is to some tests, we must "escape"
2 # them in case they contain other substitutions. Otherwise, the substitutions
3 # will be fully expanded when passed to the tests. For example, we want an
4 # %{exec} substitution that contains `--execdir %{temp}` to be passed as-is, without
5 # substituting the directory. This way, the test itself can populate %{temp} as it
6 # sees fit, and %{exec} will respect it.
7 #
8 # To solve this problem, we pickle the substitutions and base64 encode that
9 # to pass it to the test, and we decode and unpickle the substitutions from
10 # within the test.
11 import base64, lit.util, pickle
12
13 base64Encode = lambda s: base64.b64encode(s).decode("utf-8")
14 escapedSubstitutions = base64Encode(pickle.dumps(config.substitutions))
15 config.substitutions.append(("%{substitutions}", escapedSubstitutions))