summaryrefslogtreecommitdiffstats
path: root/drivers/base/Kconfig
diff options
context:
space:
mode:
authorLaura Abbott <labbott@redhat.com>2016-10-07 09:09:30 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-27 17:47:12 +0200
commit248ff02165437864146d6fbd2d99b2359c3723e6 (patch)
tree09d222e8602965be3b17668c90886f2019c47885 /drivers/base/Kconfig
parent2a9becdd4dbed499815938308bdab9aae70dd561 (diff)
driver core: Make Kconfig text for DEBUG_TEST_DRIVER_REMOVE stronger
The current state of driver removal is not great. CONFIG_DEBUG_TEST_DRIVER_REMOVE finds lots of errors. The help text currently undersells exactly how many errors this option will find. Add a bit more description to indicate this option shouldn't be turned on unless you actually want to debug driver removal. The text can be changed later when more drivers are fixed up. Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/Kconfig')
-rw-r--r--drivers/base/Kconfig6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index fdf44cac08e6..d02e7c0f5bfd 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -213,14 +213,16 @@ config DEBUG_DEVRES
If you are unsure about this, Say N here.
config DEBUG_TEST_DRIVER_REMOVE
- bool "Test driver remove calls during probe"
+ bool "Test driver remove calls during probe (UNSTABLE)"
depends on DEBUG_KERNEL
help
Say Y here if you want the Driver core to test driver remove functions
by calling probe, remove, probe. This tests the remove path without
having to unbind the driver or unload the driver module.
- If you are unsure about this, say N here.
+ This option is expected to find errors and may render your system
+ unusable. You should say N here unless you are explicitly looking to
+ test this functionality.
config SYS_HYPERVISOR
bool
f='#n8'>8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
<?php

/**
* ownCloud - News
*
* @author Alessandro Cosentino
* @author Bernhard Posselt
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* @copyright 2012 Bernhard Posselt dev@bernhard-posselt.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\News\Utility;

require_once(__DIR__ . "/../../classloader.php");


class ConfigFetcherTest extends \OCA\AppFramework\Utility\TestUtility {

	private $fileSystem;
	private $config;
	private $configPath;

	public function setUp() {
		$this->api = $this->getMockBuilder(
			'\OCA\AppFramework\Core\API')
			->disableOriginalConstructor()
			->getMock();
		$this->fileSystem = $this->getMock('FileSystem', array(
			'file_get_contents',
			'file_put_contents',
			'file_exists'
		));
		$this->config = new Config($this->fileSystem, $this->api);
		$this->configPath = 'config.json';
	}


	public function testDefaults() {
		$this->assertEquals(60, $this->config->getAutoPurgeMinimumInterval());
		$this->assertEquals(200, $this->config->getAutoPurgeCount());
		$this->assertEquals(30*60, $this->config->getSimplePieCacheDuration());
		$this->assertEquals(60, $this->config->getFeedFetcherTimeout());
		$this->assertEquals(true, $this->config->getUseCronUpdates());
	}


	public function testRead () {
		$this->fileSystem->expects($this->once())
			->method('file_get_contents')
			->with($this->equalTo($this->configPath))
			->will($this->returnValue('{"autoPurgeCount": 3}'));

		$this->config->read($this->configPath);

		$this->assertEquals(3, $this->config->getAutoPurgeCount());
	}


	public function testReadLogsInvalidValue() {
		$this->fileSystem->expects($this->once())
			->method('file_get_contents')
			->with($this->equalTo($this->configPath))
			->will($this->returnValue('{"autoPurgeCounts": 3}'));
		$this->api->expects($this->once())
			->method('log')
			->with($this->equalTo('Configuration value "autoPurgeCounts" ' . 
				'does not exist. Ignored value.'), 
				$this->equalTo('warn'));

		$this->config->read($this->configPath);
	}


	public function testReadLogsInvalidJSON() {
		$this->fileSystem->expects($this->once())
			->method('file_get_contents')
			->with($this->equalTo($this->configPath))
			->will($this->returnValue(null));
		$this->api->expects($this->once())
			->method('log')
			->with($this->equalTo('Configuration contains invalid JSON'), 
				$this->equalTo('warn'));

		$this->config->read($this->configPath);
	}


	public function testWrite () {
		$json = "{\n" .
			"    \"autoPurgeMinimumInterval\": 60,\n" . 
			"    \"autoPurgeCount\": 3,\n" . 
			"    \"simplePieCacheDuration\": 1800,\n" . 
			"    \"feedFetcherTimeout\": 60,\n" . 
			"    \"useCronUpdates\": true\n" . 
		"}";
		$this->config->setAutoPurgeCount(3);

		$this->fileSystem->expects($this->once())
			->method('file_put_contents')
			->with($this->equalTo($this->configPath),
				$this->equalTo($json));

		$this->config->write($this->configPath);
	}


	public function testReadingNonExistentConfigWillWriteDefaults() {
		$this->fileSystem->expects($this->once())
			->method('file_exists')
			->with($this->equalTo($this->configPath))
			->will($this->returnValue(false));

		$json = "{\n" .
			"    \"autoPurgeMinimumInterval\": 60,\n" . 
			"    \"autoPurgeCount\": 200,\n" . 
			"    \"simplePieCacheDuration\": 1800,\n" . 
			"    \"feedFetcherTimeout\": 60,\n" . 
			"    \"useCronUpdates\": true\n" . 
		"}";

		$this->fileSystem->expects($this->once())
			->method('file_put_contents')
			->with($this->equalTo($this->configPath),
				$this->equalTo($json));

		$this->config->read($this->configPath, true);
	}

}