[LNT] r248847 - [LNT] Add mem_bytes sample type to NT suite

Luke Larson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 16:08:10 PDT 2015


Author: llarson
Date: Tue Sep 29 18:08:10 2015
New Revision: 248847

URL: http://llvm.org/viewvc/llvm-project?rev=248847&view=rev
Log:
[LNT] Add mem_bytes sample type to NT suite

Added:
    lnt/trunk/lnt/server/db/migrations/upgrade_5_to_6.py
Modified:
    lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt_db_create.sql
    lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py
    lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql

Added: lnt/trunk/lnt/server/db/migrations/upgrade_5_to_6.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrations/upgrade_5_to_6.py?rev=248847&view=auto
==============================================================================
--- lnt/trunk/lnt/server/db/migrations/upgrade_5_to_6.py (added)
+++ lnt/trunk/lnt/server/db/migrations/upgrade_5_to_6.py Tue Sep 29 18:08:10 2015
@@ -0,0 +1,48 @@
+# Version 6 adds a "mem_bytes"" Sample type to "nts".
+
+import os
+import sys
+
+import sqlalchemy
+from sqlalchemy import *
+
+###
+# Upgrade TestSuite
+
+# Import the original schema from upgrade_0_to_1 since upgrade_5_to_6 does not
+# change the actual schema.
+import lnt.server.db.migrations.upgrade_0_to_1 as upgrade_0_to_1
+
+def upgrade(engine):
+    # Create a session.
+    session = sqlalchemy.orm.sessionmaker(engine)()
+
+    real_sample_type = session.query(upgrade_0_to_1.SampleType).\
+        filter_by(name = "Real").first()
+
+    ts = session.query(upgrade_0_to_1.TestSuite).filter_by(name='nts').first()
+    mem_bytes = upgrade_0_to_1.SampleField(name="mem_bytes",
+                                           type=real_sample_type,
+                                           info_key=".mem",)
+    ts.sample_fields.append(mem_bytes)
+    session.add(ts)
+
+    session.commit()
+    # upgrade_3_to_4.py added this column, so it is not in the ORM.
+    session.connection().execute("""
+UPDATE "TestSuiteSampleFields"
+SET bigger_is_better=0
+WHERE "Name"='mem_bytes'
+                                 """)
+    session.commit()
+
+    # FIXME: This is obviously not the right way to do this, but I gave up
+    # trying to find out how to do it properly in SQLAlchemy without
+    # SQLAlchemy-migrate installed.
+    session.connection().execute("""
+ALTER TABLE "NT_Sample"
+ADD COLUMN "mem_bytes" FLOAT
+""")
+    session.commit()
+
+

Modified: lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt_db_create.sql
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt_db_create.sql?rev=248847&r1=248846&r2=248847&view=diff
==============================================================================
--- lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt_db_create.sql (original)
+++ lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt_db_create.sql Tue Sep 29 18:08:10 2015
@@ -5,7 +5,7 @@ CREATE TABLE "SchemaVersion" (
 	PRIMARY KEY ("Name"), 
 	UNIQUE ("Name")
 );
-INSERT INTO "SchemaVersion" VALUES('__core__',5);
+INSERT INTO "SchemaVersion" VALUES('__core__',6);
 CREATE TABLE "TestSuite" (
 	"ID" INTEGER NOT NULL, 
 	"Name" VARCHAR(256), 
@@ -79,6 +79,7 @@ INSERT INTO "TestSuiteSampleFields" VALU
 INSERT INTO "TestSuiteSampleFields" VALUES(13,2,'size_bytes',1,'.size',8,0);
 INSERT INTO "TestSuiteSampleFields" VALUES(14,2,'mem_bytes',1,'.mem',9,0);
 INSERT INTO "TestSuiteSampleFields" VALUES(15,1,'score',1,'.score',NULL,1);
+INSERT INTO "TestSuiteSampleFields" VALUES(16,1,'mem_bytes',1,'.mem',NULL,0);
 CREATE TABLE "TestSuiteMachineFields" (
 	"ID" INTEGER NOT NULL, 
 	"TestSuiteID" INTEGER, 
@@ -141,15 +142,15 @@ CREATE TABLE "NT_Sample" (
 	compile_status INTEGER, 
 	execution_status INTEGER, 
 	compile_time FLOAT, 
-	execution_time FLOAT, score FLOAT, 
+	execution_time FLOAT, score FLOAT, "mem_bytes" FLOAT, 
 	PRIMARY KEY ("ID"), 
 	FOREIGN KEY("RunID") REFERENCES "NT_Run" ("ID"), 
 	FOREIGN KEY("TestID") REFERENCES "NT_Test" ("ID"), 
 	FOREIGN KEY(compile_status) REFERENCES "StatusKind" ("ID"), 
 	FOREIGN KEY(execution_status) REFERENCES "StatusKind" ("ID")
 );
-INSERT INTO "NT_Sample" VALUES(1,1,1,NULL,NULL,0.007,0.0003,NULL);
-INSERT INTO "NT_Sample" VALUES(2,1,2,NULL,NULL,0.0072,0.0003,NULL);
+INSERT INTO "NT_Sample" VALUES(1,1,1,NULL,NULL,0.007,0.0003,NULL,NULL);
+INSERT INTO "NT_Sample" VALUES(2,1,2,NULL,NULL,0.0072,0.0003,NULL,NULL);
 CREATE TABLE "compile_Machine" (
 	"ID" INTEGER NOT NULL, 
 	"Name" VARCHAR(256), 

Modified: lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py?rev=248847&r1=248846&r2=248847&view=diff
==============================================================================
--- lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py (original)
+++ lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py Tue Sep 29 18:08:10 2015
@@ -31,6 +31,7 @@ test = ts_db.Test("test-a")
 sample = ts_db.Sample(run, test)
 sample.compile_time = 1.0
 sample.score = 4.2
+sample.mem_bytes = 58093568
 
 # Add and commit.
 ts_db.add(machine)
@@ -81,3 +82,4 @@ assert sample.run is run
 assert sample.test is test
 assert sample.compile_time == 1.0
 assert sample.score == 4.2
+assert sample.mem_bytes == 58093568

Modified: lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql?rev=248847&r1=248846&r2=248847&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql (original)
+++ lnt/trunk/tests/server/ui/Inputs/V4Pages_extra_records.sql Tue Sep 29 18:08:10 2015
@@ -6,23 +6,23 @@ INSERT INTO "NT_Machine" VALUES(2,'machi
 INSERT INTO "NT_Order" VALUES(5,4,NULL,'152290');
 UPDATE "NT_Order" SET "NextOrder" = 5 WHERE "ID" = 4;
 INSERT INTO "NT_Run" VALUES(3,2,5,'run3.json','2012-04-11 16:28:23.000000','2012-04-11 16:28:58.000000',NULL,'[]');
-INSERT INTO "NT_Sample" VALUES(3,3,1,NULL,NULL,0.001,0.0001,NULL);
+INSERT INTO "NT_Sample" VALUES(3,3,1,NULL,NULL,0.001,0.0001,NULL,NULL);
 INSERT INTO "NT_Machine" VALUES(3,'machine3','[]','AArch64','linux');
 INSERT INTO "NT_Order" VALUES(6,5,NULL,'152291');
 UPDATE "NT_Order" SET "PreviousOrder" = 6 WHERE "ID" = 5;
 INSERT INTO "NT_Run" VALUES(4,3,6,'run4.json','2012-04-11 16:28:24.000000','2012-04-11 16:28:59.000000',NULL,'[]');
-INSERT INTO "NT_Sample" VALUES(4,4,1,NULL,NULL,0.001,0.0001,NULL);
+INSERT INTO "NT_Sample" VALUES(4,4,1,NULL,NULL,0.001,0.0001,NULL,NULL);
 -- check that a regression on consecutive runs more than 1 day apart can be detected:
 INSERT INTO "NT_Test" VALUES(88,'test1');
 INSERT INTO "NT_Test" VALUES(89,'test2');
 INSERT INTO "NT_Order" VALUES(7,NULL,NULL,'152292');
 INSERT INTO "NT_Run" VALUES(5,2,7,'run5.json','2012-05-01 16:28:23.000000','2012-05-01 16:28:58.000000',NULL,'[]');
-INSERT INTO "NT_Sample" VALUES(5,5,88,0,0,0.001,1.0,NULL); -- passing result
-INSERT INTO "NT_Sample" VALUES(6,5,89,0,1,0.001,1.0,NULL); -- failing result
+INSERT INTO "NT_Sample" VALUES(5,5,88,0,0,0.001,1.0,NULL,NULL); -- passing result
+INSERT INTO "NT_Sample" VALUES(6,5,89,0,1,0.001,1.0,NULL,NULL); -- failing result
 INSERT INTO "NT_Order" VALUES(8,7,NULL,'152293');
 UPDATE "NT_Order" SET "PreviousOrder" = 8 WHERE "ID" = 7;
 INSERT INTO "NT_Run" VALUES(6,2,8,'run6.json','2012-05-03 16:28:24.000000','2012-05-03 16:28:59.000000',NULL,'[]');
-INSERT INTO "NT_Sample" VALUES(7,6,88,0,0,0.001,10.0,NULL); -- passing result 10x slower
-INSERT INTO "NT_Sample" VALUES(8,5,89,0,0,0.001,1.0,NULL); -- passing result
+INSERT INTO "NT_Sample" VALUES(7,6,88,0,0,0.001,10.0,NULL,NULL); -- passing result 10x slower
+INSERT INTO "NT_Sample" VALUES(8,5,89,0,0,0.001,1.0,NULL,NULL); -- passing result
 
 COMMIT;




More information about the llvm-commits mailing list