github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/tests/lightning_exotic_filenames/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 -eu
    17  
    18  # rebuild the directory and rename the files to use exotic file names.
    19  # (need to do it at runtime but otherwise git behaves erratically on windows)
    20  DBPATH="$TEST_DIR/exotic_filename.mydump"
    21  mkdir -p "$DBPATH"
    22  cp "tests/$TEST_NAME/data/zwk-schema-create.sql" "$DBPATH/中文庫-schema-create.sql"
    23  cp "tests/$TEST_NAME/data/zwk.zwb-schema.sql" "$DBPATH/中文庫.中文表-schema.sql"
    24  cp "tests/$TEST_NAME/data/zwk.zwb.sql" "$DBPATH/中文庫.中文表.sql"
    25  cp "tests/$TEST_NAME/data/xfn-schema-create.sql" "$DBPATH/"'x`f"n-schema-create.sql'
    26  cp "tests/$TEST_NAME/data/xfn.etn-schema.sql" "$DBPATH/"'x`f"n.exotic`table``name-schema.sql'
    27  cp "tests/$TEST_NAME/data/xfn.etn.sql" "$DBPATH/"'x`f"n.exotic`table``name.sql'
    28  
    29  run_sql 'DROP DATABASE IF EXISTS `x``f"n`;'
    30  run_sql 'DROP DATABASE IF EXISTS `中文庫`;'
    31  run_lightning -d "$DBPATH"
    32  echo 'Import finished'
    33  
    34  run_sql 'SELECT count(*) FROM `x``f"n`.`exotic``table````name`'
    35  check_contains 'count(*): 5'
    36  run_sql 'INSERT INTO `x``f"n`.`exotic``table````name` (a) VALUES ("ffffff"), ("gggggg")'
    37  run_sql 'SELECT _tidb_rowid > 80000, b > 80000 FROM `x``f"n`.`exotic``table````name` WHERE a = "ffffff"'
    38  check_contains '_tidb_rowid > 80000: 1'
    39  check_contains 'b > 80000: 1'
    40  run_sql 'SELECT _tidb_rowid > 80000, b > 80000 FROM `x``f"n`.`exotic``table````name` WHERE a = "gggggg"'
    41  check_contains '_tidb_rowid > 80000: 1'
    42  check_contains 'b > 80000: 1'
    43  
    44  run_sql 'SELECT * FROM `中文庫`.中文表'
    45  check_contains 'a: 2345'