github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/tests/lightning_sqlmode/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 run_sql 'DROP DATABASE IF EXISTS sqlmodedb' 17 18 run_lightning --config "tests/$TEST_NAME/off.toml" 19 20 run_sql 'SELECT a, b, hex(c), d FROM sqlmodedb.t WHERE id = 1' 21 check_contains 'a: 0000-00-00 00:00:00' 22 check_contains 'b: 127' 23 check_contains 'hex(c): 74' 24 check_contains 'd: ' 25 26 run_sql 'SELECT a, b, hex(c), d FROM sqlmodedb.t WHERE id = 2' 27 check_contains 'a: 0000-00-00 00:00:00' 28 check_contains 'b: -128' 29 check_contains 'hex(c): F0' 30 check_contains 'd: x,y' 31 32 run_sql 'SELECT a, b, hex(c), d FROM sqlmodedb.t WHERE id = 3' 33 check_contains 'a: 0000-00-00 00:00:00' 34 check_contains 'b: 0' 35 check_contains 'hex(c): 99' 36 check_contains 'd: ' 37 38 run_sql 'SELECT a, b, hex(c), d FROM sqlmodedb.t WHERE id = 4' 39 check_contains 'a: 2000-01-01 00:00:00' 40 check_contains 'b: 100' 41 check_contains 'hex(c): ' 42 check_contains 'd: x,y' 43 44 run_sql 'SELECT a, b, hex(c), d FROM sqlmodedb.t WHERE id = 5' 45 check_contains 'a: 0000-00-00 00:00:00' 46 check_contains 'b: 0' 47 check_contains 'hex(c): ' 48 check_contains 'd: ' 49 50 run_sql 'DROP DATABASE IF EXISTS sqlmodedb' 51 52 set +e 53 run_lightning --config "tests/$TEST_NAME/on.toml" --log-file "$TEST_DIR/sqlmode-error.log" 54 [ $? -ne 0 ] || exit 1 55 set -e 56 57 grep -q '\["kv convert failed"\].*\[original=.*kind=uint64,val=9.*\] \[originalCol=1\] \[colName=a\] \[colType="timestamp BINARY"\]' "$TEST_DIR/sqlmode-error.log"