Skip to content

Commit 5a34fa5

Browse files
committed
Added information about the setup steps neccesary for running a specifc cargo test.
1 parent d6b6117 commit 5a34fa5

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

CONTRIBUTING.md

+24
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,30 @@ To run specific tests, use appropriate flags such as:
3434
- `./y.sh test --test-libcore`
3535
- `./y.sh test --std-tests`
3636
- `cargo test -- <name of test>`
37+
##### Cargo tests
38+
To run `cargo test`s, you need to do a few things.
39+
First and foremost, set the correct `LD_LIBRARY_PATH` and `LIBRARY_PATH`.
40+
41+
You can find out this path by running `./y.sh build`.
42+
You should see output like this:
43+
```
44+
[BUILD] build system
45+
Finished `release` profile [optimized] target(s) in 0.01s
46+
Using `EXAMPLE_PATH` as path for libgccjit
47+
Finished `dev` profile [optimized + debuginfo] target(s) in 0.02s
48+
```
49+
Copy the path from that output, and use it to set `LD_LIBRARY_PATH` and `LIBRARY_PATH`.
50+
```shell
51+
export EXAMPLE_PATH=SOME_PATH
52+
export EXAMPLE_PATH=SOME_PATH
53+
```
54+
Before running any of the cargo tests, you must also first run this command:
55+
```sh
56+
./y.sh test --mini-tests
57+
```
58+
It will build some of the dependencies neccesary for running tests.
59+
60+
##### `libgccjit` tests
3761

3862
Additionally, you can run the tests of `libgccjit`:
3963

src/attributes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ fn resursively_inline<'gcc, 'tcx>(
2424
// `expect_local` ought to never fail: we should be checking a function within this codegen unit.
2525
let body = cx.tcx.optimized_mir(instance.def_id());
2626
for block in body.basic_blocks.iter() {
27-
let Some(terminator) = &block.terminator else { continue };
27+
let Some(ref terminator) = block.terminator else { continue };
2828
// I assmume that the resursive-inline issue applies only to functions, and not to drops.
2929
// In principle, a recursive, `#[inline(always)]` drop could(?) exist, but I don't think it does.
30-
let TerminatorKind::Call { func, .. } = &terminator.kind else { continue };
30+
let TerminatorKind::Call { ref func, .. } = terminator.kind else { continue };
3131
let Some((def, _args)) = func.const_fn_def() else { continue };
3232
// Check if the called function is recursively inline.
3333
if matches!(

0 commit comments

Comments
 (0)