File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 44
44
45
45
- name : Test
46
46
run : cabal test all --enable-tests --test-show-details=direct
47
+ wasi :
48
+ runs-on : ubuntu-latest
49
+ strategy :
50
+ matrix :
51
+ ghc : ['9.6', '9.8', '9.10', '9.12']
52
+ fail-fast : false
53
+ steps :
54
+ - name : setup-ghc-wasm32-wasi
55
+ run : |
56
+ cd $(mktemp -d)
57
+ curl -L https://gitlab.haskell.org/haskell-wasm/ghc-wasm-meta/-/archive/$GHC_WASM_META_REV/ghc-wasm-meta.tar.gz | tar xz --strip-components=1
58
+ ./setup.sh
59
+ ~/.ghc-wasm/add_to_github_path.sh
60
+ env :
61
+ GHC_WASM_META_REV : f0faac335c6f5e967d1bdbfca5768232483fd2a8
62
+ FLAVOUR : ${{ matrix.ghc }}
63
+ - uses : actions/checkout@v4
64
+ - name : Build
65
+ run : |
66
+ wasm32-wasi-cabal build splitmix splitmix:test:examples splitmix:test:initialization
67
+ - name : Test
68
+ run : |
69
+ for test in examples initialization; do
70
+ echo --- Running test $test ---
71
+ wasmtime $(wasm32-wasi-cabal list-bin splitmix:test:$test)
72
+ done
Original file line number Diff line number Diff line change
1
+ #include <stdint.h>
2
+ #include <sys/random.h>
3
+
4
+ uint64_t splitmix_init () {
5
+ uint64_t result ;
6
+ int r = getentropy (& result , sizeof (uint64_t ));
7
+ return r == 0 ? result : 0xfeed1000 ;
8
+ }
Original file line number Diff line number Diff line change @@ -93,7 +93,11 @@ library
93
93
c-sources : cbits-win/init.c
94
94
95
95
else
96
- c-sources : cbits-unix/init.c
96
+ if arch(wasm32)
97
+ c-sources : cbits-wasi/init.c
98
+
99
+ else
100
+ c-sources : cbits-unix/init.c
97
101
98
102
else
99
103
cpp-options : -DSPLITMIX_INIT_COMPAT= 1
@@ -226,7 +230,9 @@ test-suite splitmix-testu01
226
230
test-suite initialization
227
231
default-language : Haskell2010
228
232
type : exitcode-stdio-1.0
229
- ghc-options : -Wall -threaded -rtsopts
233
+ ghc-options : -Wall -rtsopts
234
+ if !arch(wasm32)
235
+ ghc-options : -threaded
230
236
hs-source-dirs : tests
231
237
main-is : Initialization.hs
232
238
build-depends :
You can’t perform that action at this time.
0 commit comments