2024-04-16 17:33:48 +01:00
|
|
|
package testcfg
|
|
|
|
|
|
|
|
|
|
import (
|
2024-06-05 00:43:49 +01:00
|
|
|
"math/bits"
|
2024-05-09 13:24:36 +01:00
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
|
2024-04-16 17:33:48 +01:00
|
|
|
"github.com/ncruces/go-sqlite3"
|
|
|
|
|
"github.com/tetratelabs/wazero"
|
|
|
|
|
)
|
|
|
|
|
|
2024-07-20 01:42:50 +01:00
|
|
|
// notest
|
|
|
|
|
|
2024-04-16 17:33:48 +01:00
|
|
|
func init() {
|
2024-06-05 00:43:49 +01:00
|
|
|
if bits.UintSize < 64 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-20 14:34:24 +01:00
|
|
|
sqlite3.RuntimeConfig = wazero.NewRuntimeConfig().
|
|
|
|
|
WithMemoryCapacityFromMax(true).
|
|
|
|
|
WithMemoryLimitPages(1024)
|
2024-05-09 13:24:36 +01:00
|
|
|
|
|
|
|
|
if os.Getenv("CI") != "" {
|
|
|
|
|
path := filepath.Join(os.TempDir(), "wazero")
|
|
|
|
|
if err := os.MkdirAll(path, 0777); err == nil {
|
|
|
|
|
if cache, err := wazero.NewCompilationCacheWithDir(path); err == nil {
|
|
|
|
|
sqlite3.RuntimeConfig.WithCompilationCache(cache)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-16 17:33:48 +01:00
|
|
|
}
|