github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/tests/lightning_character_sets/run.sh (about) 1 #!/bin/sh 2 # 3 # Copyright 2019 PingCAP, Inc. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 set -eux 17 18 run_lightning_expecting_fail() { 19 set +e 20 run_lightning "$@" 21 ERRCODE=$? 22 set -e 23 [ "$ERRCODE" != 0 ] 24 } 25 26 run_sql 'DROP DATABASE IF EXISTS charsets;' 27 28 # gb18030 29 30 run_lightning --config "tests/$TEST_NAME/auto.toml" -d "tests/$TEST_NAME/gb18030" 31 run_sql 'SELECT sum(`主键`) AS s FROM charsets.gb18030' 32 check_contains 's: 267' 33 run_sql 'DROP TABLE charsets.gb18030;' 34 35 run_lightning --config "tests/$TEST_NAME/gb18030.toml" -d "tests/$TEST_NAME/gb18030" 36 run_sql 'SELECT sum(`主键`) AS s FROM charsets.gb18030' 37 check_contains 's: 267' 38 run_sql 'DROP TABLE charsets.gb18030;' 39 40 run_lightning_expecting_fail --config "tests/$TEST_NAME/utf8mb4.toml" -d "tests/$TEST_NAME/gb18030" 41 42 run_lightning --config "tests/$TEST_NAME/binary.toml" -d "tests/$TEST_NAME/gb18030" 43 run_sql 'SELECT sum(`Ö÷¼ü`) AS s FROM charsets.gb18030' 44 check_contains 's: 267' 45 46 # utf8mb4 47 48 run_lightning --config "tests/$TEST_NAME/auto.toml" -d "tests/$TEST_NAME/utf8mb4" 49 run_sql 'SELECT sum(`主键`) AS s FROM charsets.utf8mb4' 50 check_contains 's: 1119' 51 run_sql 'DROP TABLE charsets.utf8mb4;' 52 53 run_lightning --config "tests/$TEST_NAME/gb18030.toml" -d "tests/$TEST_NAME/utf8mb4" 54 run_sql 'SELECT sum(`涓婚敭`) AS s FROM charsets.utf8mb4' 55 check_contains 's: 1119' 56 run_sql 'DROP TABLE charsets.utf8mb4;' 57 58 run_lightning --config "tests/$TEST_NAME/utf8mb4.toml" -d "tests/$TEST_NAME/utf8mb4" 59 run_sql 'SELECT sum(`主键`) AS s FROM charsets.utf8mb4' 60 check_contains 's: 1119' 61 run_sql 'DROP TABLE charsets.utf8mb4;' 62 63 run_lightning --config "tests/$TEST_NAME/binary.toml" -d "tests/$TEST_NAME/utf8mb4" 64 run_sql 'SELECT sum(`主键`) AS s FROM charsets.utf8mb4' 65 check_contains 's: 1119' 66 67 # mixed 68 69 run_lightning_expecting_fail --config "tests/$TEST_NAME/auto.toml" -d "tests/$TEST_NAME/mixed" 70 run_lightning_expecting_fail --config "tests/$TEST_NAME/gb18030.toml" -d "tests/$TEST_NAME/mixed" 71 run_lightning_expecting_fail --config "tests/$TEST_NAME/utf8mb4.toml" -d "tests/$TEST_NAME/mixed" 72 73 run_lightning --config "tests/$TEST_NAME/binary.toml" -d "tests/$TEST_NAME/mixed" 74 run_sql 'SELECT sum(`唯一键`) AS s FROM charsets.mixed' 75 check_contains 's: 5291' 76