parallel/testsuite/tests-to-run/sql02.sh

62 lines
2.2 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# SPDX-FileCopyrightText: 2021-2023 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
#
# SPDX-License-Identifier: GPL-3.0-or-later
2022-07-02 19:31:25 +00:00
par_sqlite() {
tmp=$(mktemp -d)
cd "$tmp"
2022-07-02 19:31:25 +00:00
echo '### Test of sqlite'
for CMDSQL in sqlite sqlite3 ; do
echo "Current command: $CMDSQL"
rm -f sqltest.$CMDSQL
# create database & table
sql $CMDSQL:///sqltest.$CMDSQL "CREATE TABLE foo(n INT, t TEXT);"
sql --list-tables $CMDSQL:///sqltest.$CMDSQL
file sqltest.$CMDSQL
sql $CMDSQL:///sqltest.$CMDSQL "INSERT INTO foo VALUES(1,'Line 1');"
sql $CMDSQL:///sqltest.$CMDSQL "INSERT INTO foo VALUES(2,'Line 2');"
sql $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql -n $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql -s '.' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql -n -s '.' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql -s '' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql -s ' ' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql --html $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql -n --html $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
sql --dbsize $CMDSQL:///sqltest.$CMDSQL
sql $CMDSQL:///sqltest.$CMDSQL "DROP TABLE foo;"
sql --dbsize $CMDSQL:///sqltest.$CMDSQL
rm -f sqltest.$CMDSQL
done
}
2022-07-02 19:31:25 +00:00
par_influx() {
echo '### Test of influx'
(
# create database & table
sql influx:/// "CREATE DATABASE parallel;"
sql --show-databases influx:///
# insert
(echo INSERT cpu,host=serverA,region=us_west value=0.64;
echo INSERT cpu,host=serverA,region=us_west value=0.65;
echo 'select * from cpu' ) |
sql influx:///parallel
sql --show-tables influx:///parallel | grep parallel;
2022-07-02 19:31:25 +00:00
sql influx:///parallel 'SELECT * FROM cpu;'
sql influx:///parallel 'SELECT "host", "region", "value" FROM "cpu"'
sql --pretty influx:///parallel 'SELECT * FROM cpu;'
sql --json influx:///parallel 'SELECT * FROM cpu;'
sql --dbsize influx:///parallel
sql -s . influx:///parallel 'SELECT * FROM cpu;'
sql --html influx:///parallel 'SELECT * FROM cpu;'
sql influx:///parallel 'drop database parallel'
2023-07-21 02:33:22 +00:00
) | perl -pe 's/\d/0/g;'
2022-07-02 19:31:25 +00:00
}
export -f $(compgen -A function | grep par_)
compgen -A function | grep par_ | sort |
parallel -j0 --tag -k --joblog +/tmp/jl-`basename $0` '{} 2>&1'