aboutsummaryrefslogtreecommitdiff
path: root/ci-tests/hello.c
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-09-23 16:06:21 -0700
committerAndrew Waterman <andrew@sifive.com>2022-09-23 16:06:21 -0700
commitd17b1767885000ed829eee9e985ae4a680f13377 (patch)
tree47f1877d85860754e942f2a73c8cd031c3e36861 /ci-tests/hello.c
parent7668b414bb84798f2f57bbd1d9708b72b091c362 (diff)
downloadspike-d17b1767885000ed829eee9e985ae4a680f13377.zip
spike-d17b1767885000ed829eee9e985ae4a680f13377.tar.gz
spike-d17b1767885000ed829eee9e985ae4a680f13377.tar.bz2
Actually run a program in CI
To avoid long CI times, keep the program in binary form. To avoid storing binary files in this repository, store the binaries as an asset on a github release.
Diffstat (limited to 'ci-tests/hello.c')
-rw-r--r--ci-tests/hello.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ci-tests/hello.c b/ci-tests/hello.c
new file mode 100644
index 0000000..cf10e80
--- /dev/null
+++ b/ci-tests/hello.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+int main()
+{
+ // As a simple benchmark, estimate pi
+ int n = 16384, misses = 0;
+
+ for (int i = 0; i < n; i++) {
+
+ for (int j = 0; j < n; j++) {
+ int x = i - (n / 2);
+ int y = j - (n / 2);
+
+ misses += (x * x + y * y >= (n / 2) * (n / 2));
+ }
+ }
+
+ double pi = 4.0 * (n * n - misses) / (n * n);
+
+ printf("Hello, world! Pi is approximately %f.\n", pi);
+
+ return 0;
+}