| 1 |
# |
| 2 |
# Test based on mysql-test/suite/sys_vars/t/all_vars.test |
| 3 |
# and adapted for the performance schema tables. |
| 4 |
# |
| 5 |
# This test verifies that *all* performance schema tables are tested |
| 6 |
# by the perfschema test suite. |
| 7 |
# In particular, every table there must be covered by: |
| 8 |
# - a ddl_<table_name>.test file. |
| 9 |
# - a dml_<table_name>.test file. |
| 10 |
# - a idx_<table_name>.test file. |
| 11 |
# |
| 12 |
|
| 13 |
# |
| 14 |
# we can diff in perl or in sql, as it's my_SQL_test suite, do it in sql |
| 15 |
# |
| 16 |
|
| 17 |
perl; |
| 18 |
use File::Basename; |
| 19 |
my $dirname=dirname($ENV{MYSQLTEST_FILE}); |
| 20 |
my @all_tests=<$dirname/*.test>; |
| 21 |
open(F, '>', "$ENV{MYSQLTEST_VARDIR}/tmp/perfschema-all_tests.txt") or die; |
| 22 |
binmode F; |
| 23 |
print F join "\n", sort map { basename $_ } @all_tests; |
| 24 |
EOF |
| 25 |
|
| 26 |
--disable_warnings |
| 27 |
drop table if exists t1; |
| 28 |
drop table if exists t2; |
| 29 |
--enable_warnings |
| 30 |
|
| 31 |
create table t1 (test_name text); |
| 32 |
create table t2 (test_name text); |
| 33 |
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> |
| 34 |
eval load data infile "$MYSQLTEST_VARDIR/tmp/perfschema-all_tests.txt" into table t1; |
| 35 |
|
| 36 |
insert into t2 select concat('ddl_', table_name, '.test') from information_schema.tables |
| 37 |
where table_schema='performance_schema'; |
| 38 |
insert into t2 select concat('dml_', table_name, '.test') from information_schema.tables |
| 39 |
where table_schema='performance_schema'; |
| 40 |
insert into t2 select concat('idx_', table_name, '.test') from information_schema.tables |
| 41 |
where table_schema='performance_schema'; |
| 42 |
|
| 43 |
# Abbreviations used for naming test files: |
| 44 |
update t2 set test_name= replace(test_name, "events_waits_summary_", "ews_"); |
| 45 |
update t2 set test_name= replace(test_name, "events_stages_summary_", "esgs_"); |
| 46 |
update t2 set test_name= replace(test_name, "events_statements_histogram_", "esmh_"); |
| 47 |
update t2 set test_name= replace(test_name, "events_statements_summary_", "esms_"); |
| 48 |
update t2 set test_name= replace(test_name, "events_transactions_summary_", "ets_"); |
| 49 |
update t2 set test_name= replace(test_name, "events_errors_summary_", "ees_"); |
| 50 |
update t2 set test_name= replace(test_name, "file_summary_", "fs_"); |
| 51 |
update t2 set test_name= replace(test_name, "objects_summary_", "os_"); |
| 52 |
update t2 set test_name= replace(test_name, "table_io_waits_summary_", "tiws_"); |
| 53 |
update t2 set test_name= replace(test_name, "table_lock_waits_summary_", "tlws_"); |
| 54 |
update t2 set test_name= replace(test_name, "memory_summary_", "mems_"); |
| 55 |
update t2 set test_name= replace(test_name, "user_variables_", "uvar_"); |
| 56 |
|
| 57 |
# Debug |
| 58 |
# select test_name as 'FOUND' from t1; |
| 59 |
# select test_name as 'EXPECTED' from t2; |
| 60 |
|
| 61 |
delete from t2 where t2.test_name in (select t1.test_name from t1); |
| 62 |
|
| 63 |
# If this fails, the test listed in the output is missing from the test suite. |
| 64 |
# The way to fix the failure is to implement the missing test, not silence this select. |
| 65 |
--sorted_result |
| 66 |
select test_name as `MISSING DDL/DML TESTS` from t2; |
| 67 |
|
| 68 |
drop table t1; |
| 69 |
drop table t2; |
| 70 |
|
| 71 |
--remove_file $MYSQLTEST_VARDIR/tmp/perfschema-all_tests.txt |