File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -23,16 +23,26 @@ jobs:
23
23
python-version : ' 3.x'
24
24
25
25
- name : Build Go code
26
- run : go build -buildmode=c-shared -o hello.so ./hello
26
+ run : |
27
+ for x in hello primitive; do
28
+ go build -buildmode=c-shared -o $x.so ./$x
29
+ done
27
30
28
31
- name : Run Python script
29
- run : python hello/hello.py > output.txt
32
+ run : |
33
+ for x in hello primitive; do
34
+ python $x/$x.py > $x.out
35
+ done
30
36
31
37
- name : Check output
32
38
run : |
33
- if [ "$(cat output.txt)" == "Hello world!" ]; then
34
- echo "Output is correct"
35
- else
36
- echo "Output is incorrect"
39
+ if [ "$(cat hello.out)" != "Hello world!" ]; then
40
+ echo "Output is incorrect:"
41
+ printf '%q\n' "$(cat hello.out)"
42
+ exit 1
43
+ fi
44
+ if [ "$(cat primitive.out)" != "10 + 15 = 25" ]; then
45
+ echo "Output is incorrect:"
46
+ printf '%q\n' "$(cat primitive.out)"
37
47
exit 1
38
- fi
48
+ fi
Original file line number Diff line number Diff line change 1
1
import ctypes
2
2
3
- lib = ctypes .CDLL ('./primitive.dll ' )
3
+ lib = ctypes .CDLL ('./primitive.so ' )
4
4
add = lib .add
5
5
6
6
# Make python convert its values to C representation.
You can’t perform that action at this time.
0 commit comments