11cb0ef41Sopenharmony_ci# Copyright 2017 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci# Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci# found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_cifrom ..local import statusfile 61cb0ef41Sopenharmony_cifrom ..outproc import base as outproc_base 71cb0ef41Sopenharmony_cifrom ..testproc import base as testproc_base 81cb0ef41Sopenharmony_cifrom ..testproc.result import Result 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci# Only check the exit code of the predictable_wrapper in 121cb0ef41Sopenharmony_ci# verify-predictable mode. Negative tests are not supported as they 131cb0ef41Sopenharmony_ci# usually also don't print allocation hashes. There are two versions of 141cb0ef41Sopenharmony_ci# negative tests: one specified by the test, the other specified through 151cb0ef41Sopenharmony_ci# the status file (e.g. known bugs). 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_cidef get_outproc(test): 191cb0ef41Sopenharmony_ci return OutProc(test.output_proc) 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciclass OutProc(outproc_base.BaseOutProc): 231cb0ef41Sopenharmony_ci """Output processor wrapper for predictable mode. It has custom process and 241cb0ef41Sopenharmony_ci has_unexpected_output implementation, but for all other methods it simply 251cb0ef41Sopenharmony_ci calls wrapped output processor. 261cb0ef41Sopenharmony_ci """ 271cb0ef41Sopenharmony_ci def __init__(self, _outproc): 281cb0ef41Sopenharmony_ci super(OutProc, self).__init__() 291cb0ef41Sopenharmony_ci self._outproc = _outproc 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci def has_unexpected_output(self, output): 321cb0ef41Sopenharmony_ci return output.exit_code != 0 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci def get_outcome(self, output): 351cb0ef41Sopenharmony_ci return self._outproc.get_outcome(output) 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ci @property 381cb0ef41Sopenharmony_ci def negative(self): 391cb0ef41Sopenharmony_ci return self._outproc.negative 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ci @property 421cb0ef41Sopenharmony_ci def expected_outcomes(self): 431cb0ef41Sopenharmony_ci return self._outproc.expected_outcomes 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ciclass PredictableFilterProc(testproc_base.TestProcFilter): 471cb0ef41Sopenharmony_ci def _filter(self, test): 481cb0ef41Sopenharmony_ci return test.skip_predictable() 49