Repository navigation
Add Goose tests - #520
Open
aardappel wants to merge 1 commit into
Open
Add Goose tests#520aardappel wants to merge 1 commit into
aardappel wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goose compiles a whole program to one C
file, which these tests build with the suite's
CLANG_FLAGS(-std=c23included), so they report as "Goose/clang". All five tests are here:
brainfuck/bf.goose: the op tree and growing tape ofbf.rs, runrecursively; flushes after every character unless
QUIETis set.base64/test.goose: the standard library'sbase64codec, a new bufferper call.
json/test.goose("Goose/clang (Typed)"): the standard library'sjson::Readermaps the text onto aCoordinatearray, as serde's derivedoes.
json/test_dom.goose("Goose/clang (DOM)"): its document tree, likeserde's
Valueor RapidJSON'sDocument.matmul/matmul.goose: the loop order ofmatmul.jl(
c[i][j] += a[i][k] * b[k][j]withjinnermost, no threads) ratherthan plb's transposed dot products. Every cell adds the same products in
the same order, so it prints exactly what
matmul.rsprints.primes/primes.goose: the sieve of Atkin, a trie of the digits and abreadth-first walk, as in
primes.rs. One difference for the README'snotes: Goose's hash map grows, and a growable value cannot be an element of
an array, which every trie node is, so a node's children are an unordered
run of at most ten (digit, node) pairs, looked up by scanning, as Zig's
array_hash_mapdoes below eight entries.Goose has no sockets of its own, so
common/goose/notify.hhands the twonotify messages to
common/libnotify(Goose calls C throughextern fn, andgoose --includeputs the header into the generated C).Build:
GOOSE_BUILDincommon/commands.mk(with-w, since the generated Ccarries runtime helpers a given test does not use), a rule per test, and a
Dockerfile step that builds
goosefrom source at a pinned commit with theimage's CMake and clang++;
versions.rbreports that commit.Checked on Ubuntu 24.04 with clang 20: every Goose target builds with its
Makefile rule and prints what the Rust and C tests print (Brainfuck byte for
byte, the same primes, the same matmul result). The Dockerfile's Goose step,
run in
debian:forky-20260713-slimwith the image's clang-22, cmake andbuild-essential, builds the compiler, and the Primes, Brainfuck and Matmul
rules then build and run there. I have not built the full image.
For reference, my numbers on that Ubuntu (WSL 2 on a Ryzen 9 9950X3D), in
seconds: the suite's flags, timed between the notify messages, median of 7
runs interleaved with the C, C++ and Rust tests built the same way (C++
against libstdc++, as that machine has no libc++):
The script that measured these, with notes on the results, is in the Goose
repository under
bench/kostya2.