Compare commits

...

3 Commits

Author SHA1 Message Date
Ayke van Laethem 730da698a3 testing: run cleanups after exiting a benchmark run
This is important, otherwise temporary directories don't get removed.

Issue found while working on Go 1.20 support.
2025-10-03 10:35:24 +02:00
Ayke van Laethem 073862ee92 fe310: add I2C pins for the HiFive1b 2025-10-02 20:26:25 +02:00
Ayke van Laethem c820d83ae2 interp: better errors when debugging interp
When debugging is enabled for interp, print better errors in a specific
case.

Before:

    !! revert because of error: interp: unsupported instruction (to be emitted at runtime)

After:

    !! revert because of error: /usr/local/go1.24.0/src/regexp/syntax/parse.go:927:27: interp: unsupported instruction (to be emitted at runtime)

So this adds error location information, which can be quite useful.
2025-10-02 05:42:08 +02:00
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -577,7 +577,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
// runtime instead of at compile time. But we need to
// revert any changes made by the call first.
if r.debug {
fmt.Fprintln(os.Stderr, indent+"!! revert because of error:", callErr.Err)
fmt.Fprintln(os.Stderr, indent+"!! revert because of error:", callErr.Error())
}
callMem.revert()
err := r.runAtRuntime(fn, inst, locals, &mem, indent)
+2 -2
View File
@@ -15,8 +15,8 @@ const (
P09 Pin = 9
P10 Pin = 10
P11 Pin = 11
P12 Pin = 12
P13 Pin = 13
P12 Pin = 12 // peripherals: I2C0 SDA
P13 Pin = 13 // peripherals: I2C0 SCL
P14 Pin = 14
P15 Pin = 15
P16 Pin = 16
+2
View File
@@ -159,6 +159,7 @@ func (b *B) ReportAllocs() {
// runN runs a single benchmark for the specified number of iterations.
func (b *B) runN(n int) {
b.runCleanup() // start fresh in the next iteration
b.N = n
runtime.GC()
b.ResetTimer()
@@ -457,6 +458,7 @@ func (b *B) Run(name string, f func(b *B)) bool {
// Only process sub-benchmarks, if any.
sub.hasSub = true
}
defer sub.runCleanup() // make sure all cleanups are run, even when panicking
if sub.run1() {
sub.run()
}