Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage to CI #287

Merged
merged 11 commits into from
Aug 6, 2024
24 changes: 23 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,29 @@ jobs:
override: true
- uses: Swatinem/rust-cache@v2
- name: test
run: cargo test --verbose --all-features
run: cargo test --workspace --verbose --all-features -- --skip read_table_version_hdfs
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json -- --skip read_table_version_hdfs
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: codecov.json
fail_ci_if_error: true
rtyler marked this conversation as resolved.
Show resolved Hide resolved
ffi_test:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Some design principles which should be considered:
```

- The crate's documentation can be easily reviewed with: `cargo docs --open`
- Code coverage is available on codecov via [cargo-llvm-cov]. See their docs for instructions to install/run locally.

[delta]: https://delta.io
[delta-protocol]: https://github.com/delta-io/delta/blob/master/PROTOCOL.md
Expand All @@ -116,3 +117,4 @@ Some design principles which should be considered:
[dat]: https://github.com/delta-incubator/dat
[derive-macros]: https://doc.rust-lang.org/reference/procedural-macros.html
[API Docs]: https://docs.rs/delta_kernel/latest/delta_kernel/
[cargo-llvm-cov]: https://github.com/taiki-e/cargo-llvm-cov
7 changes: 5 additions & 2 deletions ffi/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
/// It is not normally necessary to implement this trait directly; instead, use the provided
/// attribute macro [`#[handle_descriptor]`][delta_kernel_ffi_macros::handle_descriptor] to generate
/// the implementation automatically, e.g.
/// ```
/// ```ignore
/// # use delta_kernel_ffi_macros::handle_descriptor;
/// # use delta_kernel_ffi::handle::Handle;
/// # use handle::Handle;
/// pub struct Foo {
/// x: usize,
/// }
Expand Down Expand Up @@ -495,6 +495,7 @@ mod tests {
use super::*;
use delta_kernel_ffi_macros::handle_descriptor;

#[allow(dead_code)]
#[derive(Debug)]
pub struct Foo {
pub x: usize,
Expand All @@ -504,6 +505,7 @@ mod tests {
#[handle_descriptor(target=Foo, mutable=true, sized=true)]
pub struct MutableFoo;

#[allow(dead_code)]
#[derive(Debug)]
pub struct Bar {
pub x: usize,
Expand All @@ -529,6 +531,7 @@ mod tests {
#[handle_descriptor(target=dyn Baz, mutable=false)]
pub struct SharedBaz;

#[allow(dead_code)]
#[derive(Debug)]
pub struct NotSync {
pub ptr: *mut u32,
Expand Down
38 changes: 2 additions & 36 deletions ffi/tests/invalid-handle-code/mut-clone-handle.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,13 @@ error[E0599]: the method `clone_as_arc` exists for struct `Handle<MutFoo>`, but
--> tests/invalid-handle-code/mut-clone-handle.rs:13:15
|
8 | pub struct MutFoo;
| ----------------- doesn't satisfy 5 bounds
| ----------------- doesn't satisfy `<MutFoo as HandleDescriptor>::Mutable = False`
...
13 | let r = h.clone_as_arc();
| ^^^^^^^^^^^^ method cannot be called on `Handle<MutFoo>` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`<MutFoo as HandleDescriptor>::Mutable = False`
`<MutFoo as handle::private::HandleOps<_, False, _>>::From = Arc<_>`
`MutFoo: handle::private::SharedHandleOps<_, _>`
`MutFoo: handle::private::SharedHandle`
which is required by `MutFoo: handle::private::SharedHandleOps<_, _>`
`MutFoo: handle::private::HandleOps<_, False, _>`
which is required by `MutFoo: handle::private::SharedHandleOps<_, _>`
note: the traits `handle::private::SharedHandle`, `handle::private::HandleOps`, and `handle::private::SharedHandleOps` must be implemented
--> src/handle.rs
|
| pub trait SharedHandle {}
| ^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait HandleOps<T: ?Sized, M, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait SharedHandleOps<T: ?Sized, S>: HandleOps<T, False, S> + SharedHandle {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0271]: type mismatch resolving `<MutFoo as HandleDescriptor>::Mutable == False`
--> tests/invalid-handle-code/mut-clone-handle.rs:12:41
Expand All @@ -40,27 +23,10 @@ error[E0599]: the method `clone_handle` exists for struct `Handle<MutFoo>`, but
--> tests/invalid-handle-code/mut-clone-handle.rs:14:15
|
8 | pub struct MutFoo;
| ----------------- doesn't satisfy 5 bounds
| ----------------- doesn't satisfy `<MutFoo as HandleDescriptor>::Mutable = False`
...
14 | let h = h.clone_handle();
| ^^^^^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`<MutFoo as HandleDescriptor>::Mutable = False`
`<MutFoo as handle::private::HandleOps<_, False, _>>::From = Arc<_>`
`MutFoo: handle::private::SharedHandleOps<_, _>`
`MutFoo: handle::private::SharedHandle`
which is required by `MutFoo: handle::private::SharedHandleOps<_, _>`
`MutFoo: handle::private::HandleOps<_, False, _>`
which is required by `MutFoo: handle::private::SharedHandleOps<_, _>`
note: the traits `handle::private::SharedHandle`, `handle::private::HandleOps`, and `handle::private::SharedHandleOps` must be implemented
--> src/handle.rs
|
| pub trait SharedHandle {}
| ^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait HandleOps<T: ?Sized, M, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait SharedHandleOps<T: ?Sized, S>: HandleOps<T, False, S> + SharedHandle {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 changes: 1 addition & 17 deletions ffi/tests/invalid-handle-code/shared-as-mut.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,13 @@ error[E0599]: the method `as_mut` exists for struct `Handle<SharedFoo>`, but its
--> tests/invalid-handle-code/shared-as-mut.rs:12:15
|
7 | pub struct SharedFoo;
| -------------------- doesn't satisfy `<SharedFoo as HandleDescriptor>::Mutable = True`, `SharedFoo: handle::private::HandleOps<_, True, _>`, `SharedFoo: handle::private::MutableHandleOps<_, _>` or `SharedFoo: handle::private::MutableHandle`
| -------------------- doesn't satisfy `<SharedFoo as HandleDescriptor>::Mutable = True`
...
12 | let r = h.as_mut();
| ^^^^^^ method cannot be called on `Handle<SharedFoo>` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`<SharedFoo as HandleDescriptor>::Mutable = True`
`SharedFoo: handle::private::MutableHandleOps<_, _>`
`SharedFoo: handle::private::MutableHandle`
which is required by `SharedFoo: handle::private::MutableHandleOps<_, _>`
`SharedFoo: handle::private::HandleOps<_, True, _>`
which is required by `SharedFoo: handle::private::MutableHandleOps<_, _>`
note: the traits `handle::private::MutableHandle`, `handle::private::HandleOps`, and `handle::private::MutableHandleOps` must be implemented
--> src/handle.rs
|
| pub trait MutableHandle {}
| ^^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait HandleOps<T: ?Sized, M, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait MutableHandleOps<T: ?Sized, S>: HandleOps<T, True, S> + MutableHandle {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0271]: type mismatch resolving `<SharedFoo as HandleDescriptor>::Mutable == True`
--> tests/invalid-handle-code/shared-as-mut.rs:11:44
Expand Down
30 changes: 6 additions & 24 deletions ffi/tests/invalid-handle-code/shared-not-sync.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,14 @@ error[E0599]: the method `clone_as_arc` exists for struct `Handle<SharedNotSync>
--> tests/invalid-handle-code/shared-not-sync.rs:15:15
|
10 | pub struct SharedNotSync;
| ------------------------ doesn't satisfy `SharedNotSync: handle::private::SharedHandle` or `_: SharedHandleOps<_, _>`
| ------------------------ doesn't satisfy `_: SharedHandleOps<NotSync, True>`
...
15 | let r = h.clone_as_arc();
| ^^^^^^^^^^^^ method cannot be called on `Handle<SharedNotSync>` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`SharedNotSync: handle::private::SharedHandleOps<_, _>`
`SharedNotSync: handle::private::SharedHandle`
which is required by `SharedNotSync: handle::private::SharedHandleOps<_, _>`
note: the traits `handle::private::SharedHandle` and `handle::private::SharedHandleOps` must be implemented
--> src/handle.rs
|
| pub trait SharedHandle {}
| ^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait SharedHandleOps<T: ?Sized, S>: HandleOps<T, False, S> + SharedHandle {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`*mut u32: Sync`
which is required by `SharedNotSync: handle::private::SharedHandleOps<NotSync, True>`

error[E0277]: `*mut u32` cannot be shared between threads safely
--> tests/invalid-handle-code/shared-not-sync.rs:14:48
Expand All @@ -40,20 +31,11 @@ error[E0599]: the method `clone_handle` exists for struct `Handle<SharedNotSync>
--> tests/invalid-handle-code/shared-not-sync.rs:16:15
|
10 | pub struct SharedNotSync;
| ------------------------ doesn't satisfy `SharedNotSync: handle::private::SharedHandle` or `_: SharedHandleOps<_, _>`
| ------------------------ doesn't satisfy `_: SharedHandleOps<NotSync, True>`
...
16 | let h = h.clone_handle();
| ^^^^^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`SharedNotSync: handle::private::SharedHandleOps<_, _>`
`SharedNotSync: handle::private::SharedHandle`
which is required by `SharedNotSync: handle::private::SharedHandleOps<_, _>`
note: the traits `handle::private::SharedHandle` and `handle::private::SharedHandleOps` must be implemented
--> src/handle.rs
|
| pub trait SharedHandle {}
| ^^^^^^^^^^^^^^^^^^^^^^
...
| pub trait SharedHandleOps<T: ?Sized, S>: HandleOps<T, False, S> + SharedHandle {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`*mut u32: Sync`
which is required by `SharedNotSync: handle::private::SharedHandleOps<NotSync, True>`
Loading