[LNT] r312400 - Fix for MySQL case insensitive queries

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 17:47:16 PDT 2017


Author: cmatthews
Date: Fri Sep  1 17:47:16 2017
New Revision: 312400

URL: http://llvm.org/viewvc/llvm-project?rev=312400&view=rev
Log:
Fix for MySQL case insensitive queries

MySQL Collation is by default  'utf8_general_ci' which is not case
sensitive. In sample creation, we were making a dict of the test names,
and using this to check if new Test were added. Because the DB compare
is case sensitive, and the Python string compare is case sensitive,
when we had a test were the case of the test name changed MySQL will
issue an integrity error.  To fix, hav eht tables use the utf8_bin
collation which is case sensitive.

Added:
    lnt/trunk/tests/SharedInputs/sample-arm.json
    lnt/trunk/tests/SharedInputs/sample-arm2.json
Modified:
    lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py
    lnt/trunk/lnt/server/db/testsuitedb.py
    lnt/trunk/tests/lnttool/MySQLDB.shtest

Modified: lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py?rev=312400&r1=312399&r2=312400&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py (original)
+++ lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py Fri Sep  1 17:47:16 2017
@@ -193,7 +193,7 @@ def get_base_for_testsuite(test_suite):
 
     class Machine(UpdatedBase):
         __tablename__ = db_key_name + '_Machine'
-
+        __table_args__ = {'mysql_collate': 'utf8_bin'}  # For case sensitive compare.
         id = Column("ID", Integer, primary_key=True)
         name = Column("Name", String(256), index=True)
 
@@ -256,6 +256,7 @@ def get_base_for_testsuite(test_suite):
 
     class Test(UpdatedBase):
         __tablename__ = db_key_name + '_Test'
+        __table_args__ = {'mysql_collate': 'utf8_bin'}
         id = Column("ID", Integer, primary_key=True)
         name = Column("Name", String(256), unique=True, index=True)
 

Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=312400&r1=312399&r2=312400&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Fri Sep  1 17:47:16 2017
@@ -126,7 +126,7 @@ class TestSuiteDB(object):
 
         class Machine(self.base, ParameterizedMixin):
             __tablename__ = db_key_name + '_Machine'
-
+            __table_args__ = {'mysql_collate': 'utf8_bin'}
             DEFAULT_BASELINE_REVISION = v4db.baseline_revision
 
             fields = self.machine_fields
@@ -407,7 +407,7 @@ class TestSuiteDB(object):
 
         class Test(self.base, ParameterizedMixin):
             __tablename__ = db_key_name + '_Test'
-
+            __table_args__ = {'mysql_collate': 'utf8_bin'}  # For case sensitive compare.
             id = Column("ID", Integer, primary_key=True)
             name = Column("Name", String(256), unique=True, index=True)
 
@@ -721,6 +721,7 @@ class TestSuiteDB(object):
         class Baseline(self.base, ParameterizedMixin):
             """Baselines to compare runs to."""
             __tablename__ = db_key_name + '_Baseline'
+            __table_args__ = {'mysql_collate': 'utf8_bin'}
 
             id = Column("ID", Integer, primary_key=True)
             name = Column("Name", String(32), unique=True)

Added: lnt/trunk/tests/SharedInputs/sample-arm.json
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/SharedInputs/sample-arm.json?rev=312400&view=auto
==============================================================================
--- lnt/trunk/tests/SharedInputs/sample-arm.json (added)
+++ lnt/trunk/tests/SharedInputs/sample-arm.json Fri Sep  1 17:47:16 2017
@@ -0,0 +1,40 @@
+{
+    "Machine": {
+        "Info": {}, 
+        "Name": "llvm-tk1-02__clang_DEV__thumbv7"
+    }, 
+    "Run": {
+        "End Time": "2017-08-28 07:06:31", 
+        "Info": {
+            "__report_version__": "1", 
+            "cc1_exec_hash": "ffdaa0bf1406d314f34c80ba81efa28f9004d6ea", 
+            "cc_as_version": "clang-6.0: error: unsupported argument '-v' to option 'Wa,'", 
+            "cc_build": "DEV", 
+            "cc_dumpmachine": "armv7l-unknown-linux-gnueabihf", 
+            "cc_exec_hash": "ffdaa0bf1406d314f34c80ba81efa28f9004d6ea", 
+            "cc_ld_version": "GNU ld (GNU Binutils for Ubuntu) 2.26.1", 
+            "cc_name": "clang", 
+            "cc_src_branch": "trunk", 
+            "cc_src_revision": "311868", 
+            "cc_target": "thumbv7-unknown-linux-gnueabihf", 
+            "cc_target_assembly": "; ModuleID = '/dev/null'\nsource_filename = \"/dev/null\"\ntarget datalayout = \"e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64\"\ntarget triple = \"thumbv7-unknown-linux-gnueabihf\"\n\n!llvm.module.flags = !{!0, !1}\n!llvm.ident = !{!2}\n\n!0 = !{i32 1, !\"wchar_size\", i32 4}\n!1 = !{i32 1, !\"min_enum_size\", i32 4}\n!2 = !{!\"clang version 6.0.0 (trunk 311868)\"}", 
+            "cc_version": "clang version 6.0.0 (trunk 311868)\nTarget: armv7l-unknown-linux-gnueabihf\nThread model: posix\nInstalledDir: /home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/bin\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/5\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/5.4.0\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/6\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/6.0.0\nSelected GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/5.4.0\nCandidate multilib: .;@m32\nSelected multilib: .;@m32\n \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/bin/clang-6.0\" \"-cc1\" \"-triple\" \"thumbv7-unknown-linux-gnueabihf\" \"-E\" \"-disable-free\" \"-main-file-name\" \"null\" \"-mrelocation-model\" \"static\" \"-mthread-model\" \"posix\" \"-mdisable-fp-elim\" \"-fmath-errno\" \"-masm-verbose\" \"-mconstructor-aliases\" \"-fuse-init-array\" \"-target-cpu\" \"cortex-a15\" \"-target-feature\" \"-crc\" \"-target-feature\" \"+dsp\" \"-target-feature\" \"-ras\" \"-target-feature\" \"-dotprod\" \"-target-feature\" \"+hwdiv-arm\" \"-target-feature\" \"+hwdiv\" \"-target-abi\" \"aapcs-linux\" \"-mfloat-abi\" \"hard\" \"-v\" \"-dwarf-column-info\" \"-debugger-tuning=gdb\" \"-resource-dir\" \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/lib/clang/6.0.0\" \"-internal-isystem\" \"/usr/local/include\" \"-internal-isystem\" \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/lib/clang/6.0.0/include\" \"-internal-externc-isystem\" \"/usr/include/arm-linux-gnueabihf\" \"-internal-externc-isystem\" \"/include\" \"-internal-externc-isystem\" \"/usr/include\" \"-O3\" \"-fdebug-compilation-dir\" \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/test/sandbox\" \"-ferror-limit\" \"19\" \"-fmessage-length\" \"0\" \"-fallow-half-arguments-and-returns\" \"-fno-signed-char\" \"-fobjc-runtime=gcc\" \"-fdiagnostics-show-option\" \"-vectorize-loops\" \"-vectorize-slp\" \"-o\" \"-\" \"-x\" \"c\" \"/dev/null\"", 
+            "cc_version_number": "6.0.0", 
+            "inferred_run_order": "311868", 
+            "no_errors": "True", 
+            "run_order": "311868", 
+            "tag": "nts"
+        }, 
+        "Start Time": "2017-08-28 04:38:48"
+    }, 
+    "Tests": [
+        {
+            "Data": [
+                "d527ec917aad980ed2d8006a0826b4ed"
+            ], 
+            "Info": {}, 
+            "Name": "nts.MultiSource/Applications/ALAC/decode/alacconvert-decode.hash"
+        }
+
+    ]
+}
\ No newline at end of file

Added: lnt/trunk/tests/SharedInputs/sample-arm2.json
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/SharedInputs/sample-arm2.json?rev=312400&view=auto
==============================================================================
--- lnt/trunk/tests/SharedInputs/sample-arm2.json (added)
+++ lnt/trunk/tests/SharedInputs/sample-arm2.json Fri Sep  1 17:47:16 2017
@@ -0,0 +1,40 @@
+{
+    "Machine": {
+        "Info": {}, 
+        "Name": "llvm-tk1-02__clang_DEV__thumbv7"
+    }, 
+    "Run": {
+        "End Time": "2017-08-28 07:06:31", 
+        "Info": {
+            "__report_version__": "1", 
+            "cc1_exec_hash": "ffdaa0bf1406d314f34c80ba81efa28f9004d6ea", 
+            "cc_as_version": "clang-6.0: error: unsupported argument '-v' to option 'Wa,'", 
+            "cc_build": "DEV", 
+            "cc_dumpmachine": "armv7l-unknown-linux-gnueabihf", 
+            "cc_exec_hash": "ffdaa0bf1406d314f34c80ba81efa28f9004d6ea", 
+            "cc_ld_version": "GNU ld (GNU Binutils for Ubuntu) 2.26.1", 
+            "cc_name": "clang", 
+            "cc_src_branch": "trunk", 
+            "cc_src_revision": "311868", 
+            "cc_target": "thumbv7-unknown-linux-gnueabihf", 
+            "cc_target_assembly": "; ModuleID = '/dev/null'\nsource_filename = \"/dev/null\"\ntarget datalayout = \"e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64\"\ntarget triple = \"thumbv7-unknown-linux-gnueabihf\"\n\n!llvm.module.flags = !{!0, !1}\n!llvm.ident = !{!2}\n\n!0 = !{i32 1, !\"wchar_size\", i32 4}\n!1 = !{i32 1, !\"min_enum_size\", i32 4}\n!2 = !{!\"clang version 6.0.0 (trunk 311868)\"}", 
+            "cc_version": "clang version 6.0.0 (trunk 311868)\nTarget: armv7l-unknown-linux-gnueabihf\nThread model: posix\nInstalledDir: /home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/bin\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/5\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/5.4.0\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/6\nFound candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/6.0.0\nSelected GCC installation: /usr/lib/gcc/arm-linux-gnueabihf/5.4.0\nCandidate multilib: .;@m32\nSelected multilib: .;@m32\n \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/bin/clang-6.0\" \"-cc1\" \"-triple\" \"thumbv7-unknown-linux-gnueabihf\" \"-E\" \"-disable-free\" \"-main-file-name\" \"null\" \"-mrelocation-model\" \"static\" \"-mthread-model\" \"posix\" \"-mdisable-fp-elim\" \"-fmath-errno\" \"-masm-verbose\" \"-mconstructor-aliases\" \"-fuse-init-array\" \"-target-cpu\" \"cortex-a15\" \"-target-feature\" \"-crc\" \"-target-feature\" \"+dsp\" \"-target-feature\" \"-ras\" \"-target-feature\" \"-dotprod\" \"-target-feature\" \"+hwdiv-arm\" \"-target-feature\" \"+hwdiv\" \"-target-abi\" \"aapcs-linux\" \"-mfloat-abi\" \"hard\" \"-v\" \"-dwarf-column-info\" \"-debugger-tuning=gdb\" \"-resource-dir\" \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/lib/clang/6.0.0\" \"-internal-isystem\" \"/usr/local/include\" \"-internal-isystem\" \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/stage1.install/lib/clang/6.0.0/include\" \"-internal-externc-isystem\" \"/usr/include/arm-linux-gnueabihf\" \"-internal-externc-isystem\" \"/include\" \"-internal-externc-isystem\" \"/usr/include\" \"-O3\" \"-fdebug-compilation-dir\" \"/home/buildslave/buildslave/clang-native-arm-lnt-perf/test/sandbox\" \"-ferror-limit\" \"19\" \"-fmessage-length\" \"0\" \"-fallow-half-arguments-and-returns\" \"-fno-signed-char\" \"-fobjc-runtime=gcc\" \"-fdiagnostics-show-option\" \"-vectorize-loops\" \"-vectorize-slp\" \"-o\" \"-\" \"-x\" \"c\" \"/dev/null\"", 
+            "cc_version_number": "6.0.0", 
+            "inferred_run_order": "311868", 
+            "no_errors": "True", 
+            "run_order": "311868", 
+            "tag": "nts"
+        }, 
+        "Start Time": "2017-08-28 04:38:48"
+    }, 
+    "Tests": [
+        {
+            "Data": [
+                "d527ec917aad980ed2d8006a0826b4ed"
+            ], 
+            "Info": {}, 
+            "Name": "nts.MultiSource/Applications/ALAC/decode/Alacconvert-decode.hash"
+        }
+      
+    ]
+}
\ No newline at end of file

Modified: lnt/trunk/tests/lnttool/MySQLDB.shtest
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/lnttool/MySQLDB.shtest?rev=312400&r1=312399&r2=312400&view=diff
==============================================================================
--- lnt/trunk/tests/lnttool/MySQLDB.shtest (original)
+++ lnt/trunk/tests/lnttool/MySQLDB.shtest Fri Sep  1 17:47:16 2017
@@ -11,3 +11,5 @@ lnt create "${TESTDIR}/instance" --db-di
 # Import a test set.
 lnt import "${TESTDIR}/instance" "${SHARED_INPUTS}/sample-a-small.plist" --show-sample-count
 lnt import "${TESTDIR}/instance" "${SHARED_INPUTS}/sample-b-small.plist" --show-sample-count
+lnt import "${TESTDIR}/instance" "${SHARED_INPUTS}/sample-arm.json" --format=json --show-sample-count
+lnt import "${TESTDIR}/instance" "${SHARED_INPUTS}/sample-arm2.json" --format=json --show-sample-count




More information about the llvm-commits mailing list