Skip to content

Commit

Permalink
refactor: runtime api spec gen scripts
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Jul 8, 2024
1 parent 231514c commit 38cc9fc
Show file tree
Hide file tree
Showing 13 changed files with 391 additions and 442 deletions.
5 changes: 3 additions & 2 deletions kclvm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions kclvm/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ gen-runtime-api:
make -C ./runtime gen-api-spec
make fmt

# Install the wasm target
# Install the wasm32-unknown-unknown target
install-rustc-wasm:
rustup target add wasm32-unknown-unknown

# Install the wasm-wasi target
install-rustc-wasm-wasi:
rustup target add wasm32-wasi

# Install python3 pytest
install-pytest:
python3 -mpip install --user -U pytest pytest-html pytest-xdist

# Install kclvm-py
install-kclvm-py:
python3 -mpip install --user -U kclvm

# ------------------------
# Compile and run
# ------------------------
Expand Down Expand Up @@ -82,19 +82,19 @@ codecov-lcov:
cargo llvm-cov --features llvm --lcov --output-path $(PWD)/.kclvm_cov/lcov.info -r --workspace --ignore-filename-regex gpyrpc.rs -- --nocapture

# Test runtime libaries using python functions
test-runtime: install-kclvm-py install-pytest
test-runtime: install-pytest
cd ./tests/test_units && PYTHONPATH=./../../tests/test_units/runtime python3 -m pytest -vv || { echo 'kclvm/tests/test_units failed' ; exit 1; }

# E2E grammar tests.
test-grammar: install-kclvm-py install-pytest
test-grammar: install-pytest
cd tests/integration/grammar && python3 -m pytest -v -n 5

# E2E grammar tests with the fast evaluator
test-grammar-evaluator: install-kclvm-py install-pytest
test-grammar-evaluator: install-pytest
cd tests/integration/grammar && KCL_FAST_EVAL=1 python3 -m pytest -v -n 5

# E2E konfig tests.
test-konfig: install-kclvm-py install-pytest
test-konfig: install-pytest
cd tests/integration/konfig && python3 -m pytest -v -n 5

# Parser fuzz.
Expand Down
5 changes: 5 additions & 0 deletions kclvm/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ num-integer = "0.1.44"
glob = "0.3.0"
uuid = { version = "1.7.0", features = ["serde", "v4"] }
handlebars = "5.1.2"
walkdir = "2.5.0"

[[bin]]
name = "gen-api-spec"
path = "scripts/gen-api-spec.rs"
5 changes: 2 additions & 3 deletions kclvm/runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
default:
make gen-api-spec
cargo test

gen-api-spec:
mkdir -p target

cargo clean -q

KCLVM_RUNTIME_GEN_API_SPEC= cargo build > ./src/_kclvm_api_spec.rs.tmp
KCLVM_RUNTIME_GEN_API_SPEC= cargo build -r > ./src/_kclvm_api_spec.rs.tmp

echo "// Copyright The KCL Authors. All rights reserved.\n" > ./src/_kclvm_api_spec.rs
echo "// Auto generated by <make gen-api-spec> command, DONOT EDIT!!!\n" >> ./src/_kclvm_api_spec.rs
cat ./src/_kclvm_api_spec.rs.tmp >> ./src/_kclvm_api_spec.rs
rm ./src/_kclvm_api_spec.rs.tmp

make -C ./tools/kclvm-runtime-gen-api
cargo run -r --bin gen-api-spec
7 changes: 0 additions & 7 deletions kclvm/runtime/readme.md

This file was deleted.

Loading

0 comments on commit 38cc9fc

Please sign in to comment.