Debian Codegraph @

js/src/tests/lib/adaptor.py

raw
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 # adaptor.py -- Use generators to mutate the sequence of tests to be executed.
6
7
8 def xdr_annotate(tests, options):
9 """Returns a tuple a test which is encoding the self-hosted
10 code and a generator of tests which is decoding the self-hosted
11 code."""
12 selfhosted_is_encoded = False
13 for test in tests:
14 if not test.enable and not options.run_skipped:
15 test.selfhosted_xdr_mode = "off"
16 elif not selfhosted_is_encoded:
17 test.selfhosted_xdr_mode = "encode"
18 selfhosted_is_encoded = True
19 else:
20 test.selfhosted_xdr_mode = "decode"
21 yield test