Can not run targeted benchmark function in project
Get the following error after trying to run c3c bench example:
⚠️ The compiler encountered an unexpected error: "Violated assert: compiler.context.main || compiler.build.no_entry".
- Function: exe_name(...)
- Source file: /build/source/src/compiler/compiler.c:177
🙏 Please consider taking the time to file an issue on GitHub, so that we can get it fixed:
https://github.com/c3lang/c3c/issues/new so that we can get it fixed.
Steps to reproduce:
- Create
project.json,example.c3andbuild/directory - Add the following lines:
{
"output": "build",
"targets": {
"example": {
"type": "benchmark",
"sources": [ "example.c3" ],
},
},
"cpu": "generic",
"opt": "O0",
}
- Run
c3c bench example
c3c version: 0.6.5 (WIP)
This has led to some discussion. What's done here is odd: we're running "bench" which takes any target and tries to run its benchmarks, but in this case the target is a benchmark target which should benchmark automatically.
This means we have:
- Normal target - bench
- Bench target - run
- Bench target - build
- Bench target - bench
All of them which would then presumably just run the benchmarks. This is not reasonable.
We can simply make a restriction for c3c bench to be run on 'benchmark' targets only. For project benches we have c3c benchmark
And it's kind of confusion to have two different commands with almost the same meaning.
But that means you'd have a lot of targets just for testing. I am not sure this is right.