c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Can not run targeted benchmark function in project

Open vssukharev opened this issue 1 year ago • 4 comments

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:

  1. Create project.json, example.c3 and build/ directory
  2. Add the following lines:
{
  "output": "build",
  "targets": {
    "example": {
      "type": "benchmark",
      "sources": [ "example.c3" ],
    },
  },
  "cpu": "generic",
  "opt": "O0",
}
  1. Run c3c bench example

c3c version: 0.6.5 (WIP)

vssukharev avatar Nov 30 '24 08:11 vssukharev

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:

  1. Normal target - bench
  2. Bench target - run
  3. Bench target - build
  4. Bench target - bench

All of them which would then presumably just run the benchmarks. This is not reasonable.

lerno avatar Dec 06 '24 21:12 lerno

We can simply make a restriction for c3c bench to be run on 'benchmark' targets only. For project benches we have c3c benchmark

vssukharev avatar Dec 06 '24 22:12 vssukharev

And it's kind of confusion to have two different commands with almost the same meaning.

vssukharev avatar Dec 06 '24 22:12 vssukharev

But that means you'd have a lot of targets just for testing. I am not sure this is right.

lerno avatar Dec 08 '24 18:12 lerno