Skip to content

Commit 3624f13

Browse files
committed
Cleanup README
1 parent b664f4d commit 3624f13

File tree

3 files changed

+37
-15
lines changed

3 files changed

+37
-15
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ jobs:
2424
- uses: actions/checkout@v3
2525
- name: Run tests
2626
run: cargo test --features=${{ matrix.version }} --verbose
27+
- name: Run tests with Couchbase Lite C leak check
28+
run: LEAK_CHECK=y cargo test --features=${{ matrix.version }} --verbose -- --test-threads 1
2729
- name: Run tests (with address sanitizer)
2830
run: LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test --features=${{ matrix.version }} --verbose

README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,25 @@ Installation instructions are [here][BINDGEN_INSTALL].
2020

2121
### 2. Build!
2222

23-
You can use Couchbase Lite C community or entreprise editions:
23+
There two different editions of Couchbase Lite C: community & enterprise.
24+
You can find the differences [here][CBL_EDITIONS_DIFF].
25+
26+
When building or declaring this repository as a dependency, you need to specify the edition through a cargo feature:
2427

2528
```shell
26-
$ cargo build --features=enterprise
29+
$ cargo build --features=community
2730
```
2831

2932
```shell
30-
$ cargo build --features=community
33+
$ cargo build --features=enterprise
3134
```
3235

3336
## Maintaining
3437

3538
### Couchbase Lite For C
3639

3740
The Couchbase Lite For C shared library and headers ([Git repo][CBL_C]) are already embedded in this repo.
38-
They are present in the directory `libcblite`.
41+
They are present in two directories, one for each edition: `libcblite_community` & `libcblite_enterprise`.
3942

4043
### Upgrade Couchbase Lite C
4144

@@ -54,24 +57,39 @@ $ brew install wget
5457
$ brew install bash
5558
```
5659

57-
After that, fix the compilation & tests and you can create a pull request.
60+
If the script was successful:
61+
- Change the link `CBL_API_REFERENCE` in this README
62+
- Change the version in the test `couchbase_lite_c_version_test`
63+
- Update the version in `Cargo.toml`
64+
- Fix the compilation in both editions
65+
- Fix the tests in both editions
66+
- Create pull request
5867

5968
New C features should also be added to the Rust API at some point.
6069

6170
### Test
6271

63-
**The unit tests must be run single-threaded.** This is because each test case checks for leaks by
64-
counting the number of extant Couchbase Lite objects before and after it runs, and failing if the
65-
number increases. That works only if a single test runs at a time.
72+
Tests can be found in the `tests` subdirectory.
73+
Test are run in the GitHub wrokflow `Test`. You can find the commands used there.
74+
75+
There are three variations:
76+
77+
### Nominal run
78+
79+
```shell
80+
$ cargo test --features=enterprise
81+
```
82+
83+
### Run with Couchbase Lite C leak check
6684

6785
```shell
68-
$ LEAK_CHECK=y cargo test -- --test-threads 1
86+
$ LEAK_CHECK=y cargo test --features=enterprise -- --test-threads 1
6987
```
7088

71-
### Sanitizer
89+
### Run with address sanitizer
7290

7391
```shell
74-
$ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test
92+
$ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nightly test --features=enterprise
7593
```
7694

7795
## Learning
@@ -96,6 +114,8 @@ $ LSAN_OPTIONS=suppressions=san.supp RUSTFLAGS="-Zsanitizer=address" cargo +nigh
96114

97115
[CBL_API_REFERENCE]: https://docs.couchbase.com/mobile/3.2.1/couchbase-lite-c/C/html/modules.html
98116

117+
[CBL_EDITIONS_DIFF]: https://www.couchbase.com/products/editions/
118+
99119
[FLEECE]: https://github.com/couchbaselabs/fleece/wiki/Using-Fleece
100120

101121
[BINDGEN]: https://rust-lang.github.io/rust-bindgen/

tests/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ where
4343
{
4444
init_logging();
4545

46-
let start_inst_count = instance_count() as isize;
46+
let start_inst_count = instance_count();
4747
let tmp_dir = TempDir::new("cbl_rust").expect("create temp dir");
4848
let cfg = DatabaseConfiguration {
4949
directory: tmp_dir.path(),
@@ -58,11 +58,11 @@ where
5858
db.delete().unwrap();
5959

6060
if LEAK_CHECK.is_some() {
61-
warn!("Couchbase Lite objects were leaked by this test");
61+
info!("Checking if Couchbase Lite objects were leaked by this test");
6262
dump_instances();
6363
assert_eq!(
64-
instance_count() as usize,
65-
start_inst_count as usize,
64+
instance_count(),
65+
start_inst_count,
6666
"Native object leak: {} objects, was {}",
6767
instance_count(),
6868
start_inst_count

0 commit comments

Comments
 (0)