internal/rosa/azalea: ast and parser
Some checks failed
Test / Flake checks (push) Has been cancelled
Test / Sandbox (push) Has started running
Test / Hakurei (race detector) (push) Has been cancelled
Test / Hakurei (push) Has been cancelled
Test / Sandbox (race detector) (push) Has been cancelled
Test / ShareFS (push) Has been cancelled
Test / Create distribution (push) Has been cancelled
Some checks failed
Test / Flake checks (push) Has been cancelled
Test / Sandbox (push) Has started running
Test / Hakurei (race detector) (push) Has been cancelled
Test / Hakurei (push) Has been cancelled
Test / Sandbox (race detector) (push) Has been cancelled
Test / ShareFS (push) Has been cancelled
Test / Create distribution (push) Has been cancelled
This syntax is not final, but acts as a stopgap solution and a proof of concept. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package azalea_test
|
package azalea_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -9,6 +10,9 @@ import (
|
|||||||
"hakurei.app/internal/rosa/azalea"
|
"hakurei.app/internal/rosa/azalea"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed testdata/gcc.az
|
||||||
|
var sample string
|
||||||
|
|
||||||
func TestParse(t *testing.T) {
|
func TestParse(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@@ -56,65 +60,7 @@ func TestParse(t *testing.T) {
|
|||||||
{"truncated array", `[ "\x00"`, nil,
|
{"truncated array", `[ "\x00"`, nil,
|
||||||
azalea.ExprError(scanner.EOF)},
|
azalea.ExprError(scanner.EOF)},
|
||||||
|
|
||||||
{"gcc", `
|
{"gcc", sample, []any{azalea.Func{
|
||||||
package gcc {
|
|
||||||
description = "The GNU Compiler Collection";
|
|
||||||
website = "https://www.gnu.org/software/gcc";
|
|
||||||
anitya = 6502;
|
|
||||||
|
|
||||||
version* = "16.1.0";
|
|
||||||
source = remoteTar {
|
|
||||||
url = "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"+
|
|
||||||
"gcc-"+version+"/gcc-"+version+".tar.gz";
|
|
||||||
checksum = "4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K";
|
|
||||||
compress = gzip;
|
|
||||||
};
|
|
||||||
patches = [
|
|
||||||
"musl-off64_t-loff_t.patch",
|
|
||||||
"musl-legacy-lfs.patch",
|
|
||||||
];
|
|
||||||
|
|
||||||
// GCC spends most of its time in its many configure scripts, however
|
|
||||||
// it also saturates the CPU for a consequential amount of time.
|
|
||||||
exclusive = true;
|
|
||||||
|
|
||||||
exec = make {
|
|
||||||
configure = {
|
|
||||||
"disable-multilib";
|
|
||||||
"enable-default-pie";
|
|
||||||
"disable-nls";
|
|
||||||
"with-gnu-as";
|
|
||||||
"with-gnu-ld";
|
|
||||||
"with-system-zlib";
|
|
||||||
"enable-languages": "c,c++,go";
|
|
||||||
"with-native-system-header-dir": "/system/include";
|
|
||||||
"with-multilib-list": arch {
|
|
||||||
amd64, arm64 = "''";
|
|
||||||
default = unset;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
make = [
|
|
||||||
"BOOT_CFLAGS='-O2 -g'",
|
|
||||||
noop { key = value; },
|
|
||||||
"bootstrap",
|
|
||||||
];
|
|
||||||
|
|
||||||
// This toolchain is hacked to pieces, it is not expected to ever work
|
|
||||||
// well in its current state. That does not matter as long as the
|
|
||||||
// toolchain it produces passes its own test suite.
|
|
||||||
skip-check = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
inputs = [
|
|
||||||
binutils,
|
|
||||||
|
|
||||||
mpc,
|
|
||||||
zlib,
|
|
||||||
libucontext,
|
|
||||||
kernel-headers,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
`, []any{azalea.Func{
|
|
||||||
Ident: "gcc",
|
Ident: "gcc",
|
||||||
Package: true,
|
Package: true,
|
||||||
|
|
||||||
|
|||||||
57
internal/rosa/azalea/testdata/gcc.az
vendored
Normal file
57
internal/rosa/azalea/testdata/gcc.az
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
package gcc {
|
||||||
|
description = "The GNU Compiler Collection";
|
||||||
|
website = "https://www.gnu.org/software/gcc";
|
||||||
|
anitya = 6502;
|
||||||
|
|
||||||
|
version* = "16.1.0";
|
||||||
|
source = remoteTar {
|
||||||
|
url = "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"+
|
||||||
|
"gcc-"+version+"/gcc-"+version+".tar.gz";
|
||||||
|
checksum = "4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K";
|
||||||
|
compress = gzip;
|
||||||
|
};
|
||||||
|
patches = [
|
||||||
|
"musl-off64_t-loff_t.patch",
|
||||||
|
"musl-legacy-lfs.patch",
|
||||||
|
];
|
||||||
|
|
||||||
|
// GCC spends most of its time in its many configure scripts, however
|
||||||
|
// it also saturates the CPU for a consequential amount of time.
|
||||||
|
exclusive = true;
|
||||||
|
|
||||||
|
exec = make {
|
||||||
|
configure = {
|
||||||
|
"disable-multilib";
|
||||||
|
"enable-default-pie";
|
||||||
|
"disable-nls";
|
||||||
|
"with-gnu-as";
|
||||||
|
"with-gnu-ld";
|
||||||
|
"with-system-zlib";
|
||||||
|
"enable-languages": "c,c++,go";
|
||||||
|
"with-native-system-header-dir": "/system/include";
|
||||||
|
"with-multilib-list": arch {
|
||||||
|
amd64, arm64 = "''";
|
||||||
|
default = unset;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
make = [
|
||||||
|
"BOOT_CFLAGS='-O2 -g'",
|
||||||
|
noop { key = value; },
|
||||||
|
"bootstrap",
|
||||||
|
];
|
||||||
|
|
||||||
|
// This toolchain is hacked to pieces, it is not expected to ever work
|
||||||
|
// well in its current state. That does not matter as long as the
|
||||||
|
// toolchain it produces passes its own test suite.
|
||||||
|
skip-check = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
binutils,
|
||||||
|
|
||||||
|
mpc,
|
||||||
|
zlib,
|
||||||
|
libucontext,
|
||||||
|
kernel-headers,
|
||||||
|
];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user