forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_names.py
56 lines (48 loc) · 2.97 KB
/
check_names.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import sys
from typing import List
def get_java_files(directory_path: str) -> List[str]:
java_files: List[str] = []
for root, dirs, files in os.walk(directory_path):
for f in files:
if f.endswith('.java'):
java_files.append(f)
return java_files
def verify_one_db(prefix: str, files: List[str]):
print('checking database, name: {0}, files: {1}'.format(prefix, files))
if len(files) == 0:
print(prefix + ' directory does not contain any files!', file=sys.stderr)
exit(-1)
for f in files:
if not f.startswith(prefix):
print('The class name of ' + f + ' does not start with ' + prefix, file=sys.stderr)
exit(-1)
print('checking database pass: ', prefix)
def verify_all_dbs(name_to_files: dict[str:List[str]]):
for db_name, files in name_to_files.items():
verify_one_db(db_name, files)
if __name__ == '__main__':
cwd = os.getcwd()
print("Current working directory: {0}".format(cwd))
name_to_files: dict[str:List[str]] = dict()
name_to_files["Citus"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "citus"))
name_to_files["ClickHouse"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "clickhouse"))
name_to_files["CnosDB"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "cnosdb"))
name_to_files["CockroachDB"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "cockroachdb"))
name_to_files["Databend"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "databend"))
name_to_files["DataFusion"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "datafusion"))
name_to_files["DuckDB"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "duckdb"))
name_to_files["H2"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "h2"))
name_to_files["HSQLDB"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "hsqldb"))
name_to_files["MariaDB"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "mariadb"))
name_to_files["Materialize"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "materialize"))
name_to_files["MySQL"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "mysql"))
name_to_files["OceanBase"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "oceanbase"))
name_to_files["Postgres"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "postgres"))
name_to_files["Presto"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "presto"))
name_to_files["QuestDB"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "questdb"))
name_to_files["SQLite3"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "sqlite3"))
name_to_files["TiDB"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "tidb"))
name_to_files["Y"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "yugabyte")) # has both YCQL and YSQL prefixes
name_to_files["Doris"] = get_java_files(os.path.join(cwd, "src", "sqlancer", "doris"))
verify_all_dbs(name_to_files)