| 1 |
import sys |
| 2 |
import py |
| 3 |
from rpython.config.translationoption import get_combined_translation_config |
| 4 |
from rpython.config.translationoption import set_opt_level |
| 5 |
from rpython.config.translationoption import get_translation_config |
| 6 |
from rpython.config import translationoption |
| 7 |
from rpython.config.config import ConflictConfigError, ConfigError |
| 8 |
from rpython.translator.platform import platform as compiler |
| 9 |
|
| 10 |
|
| 11 |
def test_no_gcrootfinder_with_boehm(): |
| 12 |
config = get_combined_translation_config() |
| 13 |
config.translation.gcrootfinder = "shadowstack" |
| 14 |
py.test.raises(ConflictConfigError, set_opt_level, config, '0') |
| 15 |
|
| 16 |
def test_get_translation_config(): |
| 17 |
from rpython.translator.interactive import Translation |
| 18 |
from rpython.config import config |
| 19 |
def f(x): |
| 20 |
config = get_translation_config() |
| 21 |
if config is not None: |
| 22 |
return config.translating |
| 23 |
return False |
| 24 |
|
| 25 |
t = Translation(f, [int]) |
| 26 |
config = t.config |
| 27 |
|
| 28 |
|
| 29 |
t.annotate() |
| 30 |
retvar = t.context.graphs[0].returnblock.inputargs[0] |
| 31 |
assert t.context.annotator.binding(retvar).const |
| 32 |
|
| 33 |
assert get_translation_config() is config |