Hashar has uploaded a new change for review.
https://gerrit.wikimedia.org/r/89158
Change subject: make-release: initial tarball test script
......................................................................
make-release: initial tarball test script
nitial tarball test script. It’s currently testing tarball extraction,
$wgVersion and the commandline installer and it’s working on my system.
Prerequisites:
- A MediaWiki tarball in the same folder as the test script
- Database access (currently with user root and no password)
- Write permissions in the script folder
- Phpunit installed and PHPUnit_* classes accessible by php
Usage:
phpunit testReleaseTarball <version>
Change-Id: Iac86a255af436d46b7916e9b2b314a52b78e281b
---
A make-release/testReleaseTarball.php
1 file changed, 87 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/release
refs/changes/58/89158/1
diff --git a/make-release/testReleaseTarball.php
b/make-release/testReleaseTarball.php
new file mode 100644
index 0000000..a46c0b0
--- /dev/null
+++ b/make-release/testReleaseTarball.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Usage: phpunit testReleaseTarball <version>, e.g. phpunit
testReleaseTarball 1.21.2
+ */
+class ReleaseTarballTestCase extends PHPUnit_Framework_TestCase {
+
+ private static $version;
+
+ public static function setUpBeforeClass() {
+ parent::setUpBeforeClass();
+ global $argv, $argc;
+ self::$version = $argv[2];
+ }
+
+ public function testExtractTarball() {
+ // extract tarball as described in
http://www.mediawiki.org/wiki/Manual:Installing_MediaWiki
+ $cmd = 'tar xzvf mediawiki-' . self::$version . '.tar.gz';
+ $result = shell_exec( $cmd );
+
+ // TODO: this assertion is not enough
+ $this->assertFileExists(
+ $this->getMWBasePath(),
+ "Tarball could not be extracted."
+ );
+ $this->assertFileExists(
+ $this->getDefaultSettingsFilePath(),
+ "DefaultSettings.php could not be found."
+ );
+ }
+
+ /*
+ * @depends testExtractTarball
+ */
+ public function testWgVersion() {
+ $file = file_get_contents( $this->getDefaultSettingsFilePath()
);
+ $versionAsExpected = preg_match('/.*\$wgVersion =
\''.self::$version.'\';.*/', $file);
+
+ $this->assertTrue(
+ // If found, the value will be 1
+ $versionAsExpected == 1,
+ "\$wgVersion is not set correctly."
+ );
+ }
+
+ /*
+ * @depends testWgVersion
+ */
+ public function testCliInstaller() {
+ $cmd = 'php ' . $this->getMWBasePath() .
'/maintenance/install.php'
+ //DB user for installation
+ .' --installdbuser=root'
+ //DB pass for installation
+ .' --installdbpass='
+ //admin pass
+ .' --pass=releaseTest'
+ //name
+ .' TarballTestInstallation'
+ //admin
+ .' WikiSysop';
+
+ $result = shell_exec( $cmd );
+ $this->assertFileExists(
+ $this->getMWBasePath() . '/LocalSettings.php',
+ "Installation failed: LocalSettings.php could
not be found."
+ );
+ }
+
+ // currently not used, maybe cleanup has to be done externally
+ public static function tearDownAfterClass() {
+ parent::tearDownAfterClass();
+
+ //remove install dir
+ $cmd = 'rm -r mediawiki-' . self::$version;
+ $result = shell_exec( $cmd );
+
+ //TODO: remove database
+ }
+
+
+ private function getDefaultSettingsFilePath() {
+ return $this->getMWBasePath(). '/includes/DefaultSettings.php';
+ }
+
+ private function getMWBasePath() {
+ return 'mediawiki-' . self::$version;
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/89158
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac86a255af436d46b7916e9b2b314a52b78e281b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits