From 987f0f13a2d2250e4569735777cbec248142d9a5 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Mon, 4 Dec 2023 13:46:12 +0000 Subject: [PATCH] Test CPUs. --- .github/workflows/cpu.yml | 40 +++++++++++++++++++++++++++++++++++++ .github/workflows/cross.yml | 4 +--- .github/workflows/repro.yml | 2 +- driver/time_test.go | 20 +++++++++---------- 4 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/cpu.yml diff --git a/.github/workflows/cpu.yml b/.github/workflows/cpu.yml new file mode 100644 index 0000000..8fa6ba8 --- /dev/null +++ b/.github/workflows/cpu.yml @@ -0,0 +1,40 @@ +name: CPUs + +on: + workflow_dispatch: + +jobs: + test-386: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + lfs: 'true' + + - name: Set up + uses: actions/setup-go@v4 + with: + go-version: stable + + - name: Test + run: GOARCH=386 go test -v ./... + + test-arm: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + lfs: 'true' + + - name: Set up + uses: actions/setup-go@v4 + with: + go-version: stable + + - name: Install QEMU + uses: docker/setup-qemu-action@v3 + + - name: Test + run: GOARCH=arm64 go test -v ./... \ No newline at end of file diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml index c32ca39..ac9aa9f 100644 --- a/.github/workflows/cross.yml +++ b/.github/workflows/cross.yml @@ -4,13 +4,11 @@ on: workflow_dispatch: jobs: - test: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - lfs: 'true' - name: Set up uses: actions/setup-go@v4 diff --git a/.github/workflows/repro.yml b/.github/workflows/repro.yml index ac7a594..f1d6be6 100644 --- a/.github/workflows/repro.yml +++ b/.github/workflows/repro.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: jobs: - test: + build: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] diff --git a/driver/time_test.go b/driver/time_test.go index 03dfb6a..0134629 100644 --- a/driver/time_test.go +++ b/driver/time_test.go @@ -49,14 +49,14 @@ func Fuzz_stringOrTime_1(f *testing.F) { // This checks that any [time.Time] can be recovered as a [time.Time], // with nanosecond accuracy, and preserving any timezone offset. func Fuzz_stringOrTime_2(f *testing.F) { - f.Add(0, 0) - f.Add(0, 1) - f.Add(0, -1) - f.Add(0, 999_999_999) - f.Add(0, 1_000_000_000) - f.Add(7956915742, 222_222_222) // twosday - f.Add(639095955742, 222_222_222) // twosday, year 22222AD - f.Add(-763421161058, 222_222_222) // twosday, year 22222BC + f.Add(int64(0), int64(0)) + f.Add(int64(0), int64(1)) + f.Add(int64(0), int64(-1)) + f.Add(int64(0), int64(999_999_999)) + f.Add(int64(0), int64(1_000_000_000)) + f.Add(int64(7956915742), int64(222_222_222)) // twosday + f.Add(int64(639095955742), int64(222_222_222)) // twosday, year 22222AD + f.Add(int64(-763421161058), int64(222_222_222)) // twosday, year 22222BC checkTime := func(t testing.TB, date time.Time) { value := stringOrTime([]byte(date.Format(time.RFC3339Nano))) @@ -80,7 +80,7 @@ func Fuzz_stringOrTime_2(f *testing.F) { } } - f.Fuzz(func(t *testing.T, sec, nsec int) { + f.Fuzz(func(t *testing.T, sec, nsec int64) { // Reduce the search space. if 1e12 < sec || sec < -1e12 { // Dates before 29000BC and after 33000AD; I think we're safe. @@ -91,7 +91,7 @@ func Fuzz_stringOrTime_2(f *testing.F) { return } - unix := time.Unix(int64(sec), int64(nsec)) + unix := time.Unix(sec, nsec) checkTime(t, unix) checkTime(t, unix.UTC()) checkTime(t, unix.In(time.FixedZone("", -8*3600)))