Skip to content

Commit 152214d

Browse files
authored
Make debug-coverage a proper command (databrickslabs#940)
1 parent 19c1734 commit 152214d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Makefile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,11 @@ python_coverage_report:
5050
hatch -e sqlglot-latest run python src/databricks/labs/remorph/coverage/sqlglot_tsql_transpilation_coverage.py
5151

5252
antlr_coverage_report: build_core_jar
53-
java -jar $(wildcard core/target/remorph-core-*-SNAPSHOT.jar) '{"command": "debug-coverage", "flags":{"src": "$(abspath ${INPUT_DIR_PARENT}/snowflake)", "dst":"$(abspath ${OUTPUT_DIR})", "source-dialect": "Snow", "extractor": "full"}}'
54-
java -jar $(wildcard core/target/remorph-core-*-SNAPSHOT.jar) '{"command": "debug-coverage", "flags":{"src": "$(abspath ${INPUT_DIR_PARENT}/tsql)", "dst":"$(abspath ${OUTPUT_DIR})", "source-dialect": "Tsql", "extractor": "full"}}'
53+
java -jar $(wildcard core/target/remorph-core-*-SNAPSHOT.jar) '{"command": "debug-coverage", "flags":{"src": "$(abspath ${INPUT_DIR_PARENT})", "dst":"$(abspath ${OUTPUT_DIR})", "extractor": "full"}}'
5554

5655
dialect_coverage_report: clean_coverage_dir antlr_coverage_report python_coverage_report
5756
hatch run python src/databricks/labs/remorph/coverage/local_report.py
5857

59-
antlr-coverage: build_core_jar
60-
echo "Running coverage for snowflake"
61-
java -jar $(wildcard core/target/remorph-core-*-SNAPSHOT.jar) '{"command": "coverage", "flags":{"src": "$(abspath ${INPUT_DIR_PARENT}/snowflake)", "dst":"$(abspath ${OUTPUT_DIR})", "source-dialect": "Snow", "extractor": "full"}}'
62-
echo "Running coverage for tsql"
63-
java -jar $(wildcard core/target/remorph-core-*-SNAPSHOT.jar) '{"command": "coverage", "flags":{"src": "$(abspath ${INPUT_DIR_PARENT}/tsql)", "dst":"$(abspath ${OUTPUT_DIR})", "source-dialect": "Tsql", "extractor": "full"}}'
64-
OUTPUT_DIR=.venv/antlr-coverage hatch run python src/databricks/labs/remorph/coverage/local_report.py
65-
6658
antlr-lint:
6759
mvn compile -DskipTests exec:java -pl linter --file pom.xml -Dexec.args="-i core/src/main/antlr4 -o .venv/linter/grammar -c true"
6860

labs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,12 @@ commands:
6262
description: sql dialect
6363
- name: debug-me
6464
description: "[INTERNAL] Debug SDK connectivity"
65+
- name: debug-coverage
66+
description: "[INTERNAL] Run coverage tests"
67+
flags:
68+
- name: src
69+
description: The parent directory under which test queries are laid out
70+
- name: dst
71+
description: The directory under which the report files will be written
72+
- name: extractor
73+
description: The strategy for extracting queries from the test files. Valid strategies are "full" (when files contain only one input query) and "comment" (when files contain an input query and the corresponding translation, separated by a comment stating the dialect of each query).

src/databricks/labs/remorph/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def raise_validation_exception(msg: str) -> Exception:
2626

2727
proxy_command(remorph, "debug-script")
2828
proxy_command(remorph, "debug-me")
29+
proxy_command(remorph, "debug-coverage")
2930

3031

3132
@remorph.command

0 commit comments

Comments
 (0)