rickub/ci-benchpublic Fork 0
6b67a7ef1caf6851afedfcbffa9de16df998b013
Commits
Clone
git clone https://git.rickub.com/rickub/ci-bench.git
git clone ssh://git@rickub.com/rickub/ci-bench.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

ci-bench: cross-platform CI race scaffold (rickub CI vs GitHub Actions) 0baf736Unverified · on 6b67a7ef1caf6851afedfcbffa9de16df998b013 · Olivier Girardot · yesterday
main.c · 41 lines · 1.3 KBC Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * main.c — the tiny C program the docker-build workload compiles.
 *
 * The BUILD is the benchmark (multi-stage, network fetch of build-base, gcc
 * invocation, final image assembly). The program itself just does a
 * deterministic FNV-1a pass so the binary is non-trivial and its output is
 * stable across platforms: ci-bench-docker-a56ee6092483
 */

#include <stdio.h>
#include <stdint.h>
#include <string.h>

#define ROUNDS 2000000u
#define SEED_LEN 64

static uint64_t fnv1a(uint64_t h, const unsigned char *data, size_t len) {
    for (size_t i = 0; i < len; i++) {
        h ^= data[i];
        h *= 1099511628211ULL; /* FNV prime */
    }
    return h;
}

int main(void) {
    unsigned char seed[SEED_LEN];
    for (size_t i = 0; i < SEED_LEN; i++)
        seed[i] = (unsigned char)(i * 31 + 7);

    uint64_t h = 1469598103934665603ULL; /* FNV offset basis */
    for (uint32_t r = 0; r < ROUNDS; r++) {
        seed[0] = (unsigned char)(r & 0xff);
        seed[1] = (unsigned char)((r >> 8) & 0xff);
        h = fnv1a(h, seed, SEED_LEN);
    }

    /* Expected: stable for the fixed seed/rounds above; printed so a runner
     * log shows the binary actually executed. */
    printf("ci-bench-docker-%012llx\n", (unsigned long long)(h & 0xffffffffffffULL));
    return 0;
}