Moved testRunner[|.ora|.postgres].sql to [|oracle/|postgres/]archives/ so that they...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 9 Nov 2010 17:41:00 +0000 (17:41 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 9 Nov 2010 17:41:00 +0000 (17:41 +0000)
maintenance/archives/patch-testrun.sql [new file with mode: 0644]
maintenance/oracle/archives/patch-testrun.sql [new file with mode: 0644]
maintenance/postgres/archives/patch-testrun.sql [new file with mode: 0644]
maintenance/testRunner.ora.sql [deleted file]
maintenance/testRunner.postgres.sql [deleted file]
maintenance/testRunner.sql [deleted file]
maintenance/tests/testHelpers.inc

diff --git a/maintenance/archives/patch-testrun.sql b/maintenance/archives/patch-testrun.sql
new file mode 100644 (file)
index 0000000..8591d81
--- /dev/null
@@ -0,0 +1,35 @@
+--
+-- Optional tables for parserTests recording mode
+-- With --record option, success data will be saved to these tables,
+-- and comparisons of what's changed from the previous run will be
+-- displayed at the end of each run.
+--
+-- These tables currently require MySQL 5 (or maybe 4.1?) for subselects.
+--
+
+drop table if exists /*$wgDBprefix*/testitem;
+drop table if exists /*$wgDBprefix*/testrun;
+
+create table /*$wgDBprefix*/testrun (
+  tr_id int not null auto_increment,
+  
+  tr_date char(14) binary,
+  tr_mw_version blob,
+  tr_php_version blob,
+  tr_db_version blob,
+  tr_uname blob,
+  
+  primary key (tr_id)
+) engine=InnoDB;
+
+create table /*$wgDBprefix*/testitem (
+  ti_run int not null,
+  ti_name varchar(255),
+  ti_success bool,
+  
+  unique key (ti_run, ti_name),
+  key (ti_run, ti_success),
+  
+  foreign key (ti_run) references /*$wgDBprefix*/testrun(tr_id)
+    on delete cascade
+) engine=InnoDB;
diff --git a/maintenance/oracle/archives/patch-testrun.sql b/maintenance/oracle/archives/patch-testrun.sql
new file mode 100644 (file)
index 0000000..6e3e1b7
--- /dev/null
@@ -0,0 +1,37 @@
+--
+-- Optional tables for parserTests recording mode
+-- With --record option, success data will be saved to these tables,
+-- and comparisons of what's changed from the previous run will be
+-- displayed at the end of each run.
+--
+-- defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
+define mw_prefix='{$wgDBprefix}';
+
+DROP TABLE &mw_prefix.testitem CASCADE CONSTRAINTS;
+DROP TABLE &mw_prefix.testrun CASCADE CONSTRAINTS;
+
+CREATE SEQUENCE testrun_tr_id_seq;
+CREATE TABLE &mw_prefix.testrun (
+  tr_id NUMBER NOT NULL,
+  tr_date DATE,
+  tr_mw_version BLOB,
+  tr_php_version BLOB,
+  tr_db_version BLOB,
+  tr_uname BLOB,
+);
+ALTER TABLE &mw_prefix.testrun ADD CONSTRAINT &mw_prefix.testrun_pk PRIMARY KEY (tr_id);
+CREATE OR REPLACE TRIGGER &mw_prefix.testrun_bir
+BEFORE UPDATE FOR EACH ROW
+ON &mw_prefix.testrun
+BEGIN
+  SELECT testrun_tr_id_seq.NEXTVAL into :NEW.tr_id FROM dual;
+END; 
+
+CREATE TABLE /*$wgDBprefix*/testitem (
+  ti_run NUMBER NOT NULL REFERENCES &mw_prefix.testrun (tr_id) ON DELETE CASCADE,
+  ti_name VARCHAR22(255),
+  ti_success NUMBER(1)
+);
+CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_name);
+CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_success);
+
diff --git a/maintenance/postgres/archives/patch-testrun.sql b/maintenance/postgres/archives/patch-testrun.sql
new file mode 100644 (file)
index 0000000..c15300b
--- /dev/null
@@ -0,0 +1,30 @@
+--
+-- Optional tables for parserTests recording mode
+-- With --record option, success data will be saved to these tables,
+-- and comparisons of what's changed from the previous run will be
+-- displayed at the end of each run.
+--
+-- This file is for the Postgres version of the tables
+--
+
+-- Note: "if exists" will not work on older versions of Postgres
+DROP TABLE IF EXISTS testitem;
+DROP TABLE IF EXISTS testrun;
+DROP SEQUENCE IF EXISTS testrun_id_seq;
+
+CREATE SEQUENCE testrun_id_seq;
+CREATE TABLE testrun (
+  tr_id           INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('testrun_id_seq'),
+  tr_date         TIMESTAMPTZ,
+  tr_mw_version   TEXT,
+  tr_php_version  TEXT,
+  tr_db_version   TEXT,
+  tr_uname        TEXT
+);
+
+CREATE TABLE testitem (
+  ti_run      INTEGER   NOT NULL REFERENCES testrun(tr_id) ON DELETE CASCADE,
+  ti_name     TEXT      NOT NULL,
+  ti_success  SMALLINT  NOT NULL
+);  
+CREATE UNIQUE INDEX testitem_uniq ON testitem(ti_run, ti_name);
diff --git a/maintenance/testRunner.ora.sql b/maintenance/testRunner.ora.sql
deleted file mode 100644 (file)
index 6e3e1b7..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
---
--- Optional tables for parserTests recording mode
--- With --record option, success data will be saved to these tables,
--- and comparisons of what's changed from the previous run will be
--- displayed at the end of each run.
---
--- defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
-define mw_prefix='{$wgDBprefix}';
-
-DROP TABLE &mw_prefix.testitem CASCADE CONSTRAINTS;
-DROP TABLE &mw_prefix.testrun CASCADE CONSTRAINTS;
-
-CREATE SEQUENCE testrun_tr_id_seq;
-CREATE TABLE &mw_prefix.testrun (
-  tr_id NUMBER NOT NULL,
-  tr_date DATE,
-  tr_mw_version BLOB,
-  tr_php_version BLOB,
-  tr_db_version BLOB,
-  tr_uname BLOB,
-);
-ALTER TABLE &mw_prefix.testrun ADD CONSTRAINT &mw_prefix.testrun_pk PRIMARY KEY (tr_id);
-CREATE OR REPLACE TRIGGER &mw_prefix.testrun_bir
-BEFORE UPDATE FOR EACH ROW
-ON &mw_prefix.testrun
-BEGIN
-  SELECT testrun_tr_id_seq.NEXTVAL into :NEW.tr_id FROM dual;
-END; 
-
-CREATE TABLE /*$wgDBprefix*/testitem (
-  ti_run NUMBER NOT NULL REFERENCES &mw_prefix.testrun (tr_id) ON DELETE CASCADE,
-  ti_name VARCHAR22(255),
-  ti_success NUMBER(1)
-);
-CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_name);
-CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_success);
-
diff --git a/maintenance/testRunner.postgres.sql b/maintenance/testRunner.postgres.sql
deleted file mode 100644 (file)
index c15300b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---
--- Optional tables for parserTests recording mode
--- With --record option, success data will be saved to these tables,
--- and comparisons of what's changed from the previous run will be
--- displayed at the end of each run.
---
--- This file is for the Postgres version of the tables
---
-
--- Note: "if exists" will not work on older versions of Postgres
-DROP TABLE IF EXISTS testitem;
-DROP TABLE IF EXISTS testrun;
-DROP SEQUENCE IF EXISTS testrun_id_seq;
-
-CREATE SEQUENCE testrun_id_seq;
-CREATE TABLE testrun (
-  tr_id           INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('testrun_id_seq'),
-  tr_date         TIMESTAMPTZ,
-  tr_mw_version   TEXT,
-  tr_php_version  TEXT,
-  tr_db_version   TEXT,
-  tr_uname        TEXT
-);
-
-CREATE TABLE testitem (
-  ti_run      INTEGER   NOT NULL REFERENCES testrun(tr_id) ON DELETE CASCADE,
-  ti_name     TEXT      NOT NULL,
-  ti_success  SMALLINT  NOT NULL
-);  
-CREATE UNIQUE INDEX testitem_uniq ON testitem(ti_run, ti_name);
diff --git a/maintenance/testRunner.sql b/maintenance/testRunner.sql
deleted file mode 100644 (file)
index 8591d81..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---
--- Optional tables for parserTests recording mode
--- With --record option, success data will be saved to these tables,
--- and comparisons of what's changed from the previous run will be
--- displayed at the end of each run.
---
--- These tables currently require MySQL 5 (or maybe 4.1?) for subselects.
---
-
-drop table if exists /*$wgDBprefix*/testitem;
-drop table if exists /*$wgDBprefix*/testrun;
-
-create table /*$wgDBprefix*/testrun (
-  tr_id int not null auto_increment,
-  
-  tr_date char(14) binary,
-  tr_mw_version blob,
-  tr_php_version blob,
-  tr_db_version blob,
-  tr_uname blob,
-  
-  primary key (tr_id)
-) engine=InnoDB;
-
-create table /*$wgDBprefix*/testitem (
-  ti_run int not null,
-  ti_name varchar(255),
-  ti_success bool,
-  
-  unique key (ti_run, ti_name),
-  key (ti_run, ti_success),
-  
-  foreign key (ti_run) references /*$wgDBprefix*/testrun(tr_id)
-    on delete cascade
-) engine=InnoDB;
index 24172e4..0fb4f7d 100644 (file)
@@ -309,14 +309,7 @@ class DbTestRecorder extends DbTestPreviewer  {
                        or ! $this->db->tableExists( 'testitem' ) )
                {
                        print "WARNING> `testrun` table not found in database. Trying to create table.\n";
-                       if ( $wgDBtype === 'postgres' ) {
-                               $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.postgres.sql' );
-                       } elseif ( $wgDBtype === 'oracle' ) {
-                               $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.ora.sql' );
-                       } else {
-                               $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.sql' );
-                       }
-
+                       $this->db->sourceFile( $this->db->patchPath( 'patch-testrun.sql' ) );
                        echo "OK, resuming.\n";
                }