Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | foreach ($config['engines'] as $name => $spec) { | ||||
| "Test engine '%s' specifies invalid type '%s'. ". | "Test engine '%s' specifies invalid type '%s'. ". | ||||
| "Available test engines are: %s.", | "Available test engines are: %s.", | ||||
| $name, | $name, | ||||
| $type, | $type, | ||||
| implode(', ', array_keys($test_engines)))); | implode(', ', array_keys($test_engines)))); | ||||
| } | } | ||||
| $test_engine = clone $test_engines[$type]; | $test_engine = clone $test_engines[$type]; | ||||
| $more = $test_engine->getEngineConfigurationOptions(); | |||||
| foreach ($more as $key => $option_spec) { | |||||
| PhutilTypeSpec::checkMap( | |||||
| $option_spec, | |||||
| array( | |||||
| 'type' => 'string', | |||||
| 'help' => 'string', | |||||
| )); | |||||
| $more[$key] = $option_spec['type']; | |||||
| } | |||||
| } else { | } else { | ||||
| // We'll raise an error below about the invalid "type" key. | // We'll raise an error below about the invalid "type" key. | ||||
| // TODO: Can we just do the type check first, and simplify this a bit? | // TODO: Can we just do the type check first, and simplify this a bit? | ||||
| $test_engine = null; | $test_engine = null; | ||||
| } | } | ||||
| try { | try { | ||||
| PhutilTypeSpec::checkMap( | PhutilTypeSpec::checkMap( | ||||
| $spec, | $spec, | ||||
| array( | array( | ||||
| 'type' => 'string', | 'type' => 'string', | ||||
| 'include' => 'optional regex | list<regex>', | 'include' => 'optional regex | list<regex>', | ||||
| 'exclude' => 'optional regex | list<regex>', | 'exclude' => 'optional regex | list<regex>', | ||||
| )); | ) + $more); | ||||
| } catch (PhutilTypeCheckException $ex) { | } catch (PhutilTypeCheckException $ex) { | ||||
| throw new PhutilProxyException( | throw new PhutilProxyException( | ||||
| pht( | pht( | ||||
| "Error in parsing '%s' file, for test engine '%s'.", | "Error in parsing '%s' file, for test engine '%s'.", | ||||
| '.arcunit', | '.arcunit', | ||||
| $name), | $name), | ||||
| $ex); | $ex); | ||||
| } | } | ||||
| foreach ($more as $key => $value) { | |||||
| if (array_key_exists($key, $spec)) { | |||||
| try { | |||||
| $test_engine->setEngineConfigurationValue($key, $spec[$key]); | |||||
| } catch (Exception $ex) { | |||||
| throw new PhutilProxyException( | |||||
| pht( | |||||
| "Error in parsing '%s' file, in key '%s' for test engine '%s'.", | |||||
| '.arcunit', | |||||
| $key, | |||||
| $name), | |||||
| $ex); | |||||
| } | |||||
| } | |||||
| } | |||||
| if ($all_paths) { | if ($all_paths) { | ||||
| $include = (array)idx($spec, 'include', array()); | $include = (array)idx($spec, 'include', array()); | ||||
| $exclude = (array)idx($spec, 'exclude', array()); | $exclude = (array)idx($spec, 'exclude', array()); | ||||
| $paths = $this->matchPaths( | $paths = $this->matchPaths( | ||||
| $all_paths, | $all_paths, | ||||
| $include, | $include, | ||||
| $exclude); | $exclude); | ||||
| ▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines | |||||