Skip to content

Commit f4d94c4

Browse files
authored
Add running of integration tests and fix some issues (#235)
2 parents 77e7389 + afade91 commit f4d94c4

File tree

12 files changed

+367
-26
lines changed

12 files changed

+367
-26
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ jobs:
8989
./som -G -cp core-lib/Smalltalk:core-lib/TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives \
9090
core-lib/SomSom/tests/SomSomTests.som
9191
92+
- name: Integration Tests
93+
run: |
94+
python -m pip install --upgrade pip
95+
pip install pytest
96+
97+
export CLASSPATH=Smalltalk
98+
export AWFY=core-lib/Examples/AreWeFastYet/Core
99+
100+
export TEST_EXPECTATIONS=./integration-tests-ast.yml
101+
export VM="./som -G -Dsom.interp=AST"
102+
pytest --tb=short core-lib/IntegrationTests
103+
104+
export TEST_EXPECTATIONS=./integration-tests-bc.yml
105+
export VM="./som -G -Dsom.interp=BC"
106+
pytest --tb=short core-lib/IntegrationTests
107+
92108
- name: Checkout AWFY
93109
uses: actions/checkout@v4
94110
with:

core-lib

Submodule core-lib updated 252 files

integration-tests-ast.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
known_failures: []
2+
3+
4+
failing_as_unspecified:
5+
- Tests/arbint_double_div_err.som
6+
- Tests/arbint_double_div_zero_err.som
7+
- Tests/arbint_modulus_err.som
8+
- Tests/array_at_idx0_err.som
9+
- Tests/array_at_idx2_err.som
10+
- Tests/array_at_idx_err.som
11+
- Tests/array_at_negative_idx_err.som
12+
- Tests/array_at_put_idx0_err.som
13+
- Tests/array_at_put_idx2_err.som
14+
- Tests/call2.som
15+
16+
# I think this one is about E vs e, but maybe also double rendering
17+
- Tests/double2.som
18+
- Tests/double_double_div.som
19+
- Tests/int_double_div.som
20+
# - Tests/integer_asdouble.som
21+
- Tests/int26.som
22+
23+
# I think IEEE allows for infinities here, and we probably want that
24+
- Tests/double3.som
25+
- Tests/double4.som
26+
- Tests/double5.som
27+
- Tests/double6.som
28+
- Tests/double7.som
29+
- Tests/double8.som
30+
- Tests/double9.som
31+
- Tests/double11.som
32+
- Tests/double13.som
33+
34+
# Java seems to do some rounding in the transition, but it's also requiring bigints
35+
- Tests/double_asinteger.som
36+
37+
38+
- Tests/double_double_div_err.som
39+
- Tests/double_double_div_zero_err1.som
40+
- Tests/double_double_div_zero_err2.som
41+
- Tests/double_double_div_zero_err3.som
42+
- Tests/double_double_div_zero_err4.som
43+
- Tests/double_modulus.som
44+
- Tests/double_modulus_err.som
45+
46+
- Tests/exit_double.som
47+
- Tests/exit_int_too_big.som
48+
- Tests/exit_string.som
49+
50+
- Tests/fromstring_double_err.som
51+
- Tests/fromstring_err.som
52+
53+
- Tests/hashcode2.som
54+
55+
- Tests/inst_var_at_bad_idx.som
56+
- Tests/inst_var_at_put_bad_idx.som
57+
58+
- Tests/instance_fields_overlap/test.som
59+
- Tests/instance_fields_overlap2.som
60+
61+
- Tests/int5.som
62+
- Tests/int8.som
63+
- Tests/int9.som
64+
65+
- Tests/int10.som
66+
- Tests/int11.som
67+
- Tests/int12.som
68+
- Tests/int13.som
69+
- Tests/int14.som
70+
- Tests/int15.som
71+
- Tests/int16.som
72+
- Tests/int17.som
73+
74+
# too large shifts would take too much memory to support
75+
# need to specify this some how
76+
- Tests/int20.som
77+
- Tests/int21.som
78+
- Tests/int22.som
79+
- Tests/int23.som
80+
- Tests/int25.som
81+
- Tests/int27.som
82+
- Tests/int28.som
83+
- Tests/int31.som
84+
85+
# return type of sqrt
86+
- Tests/int29.som
87+
88+
- Tests/int_double_div_err.som
89+
- Tests/int_double_div_zero_err.som
90+
- Tests/int_modulus.som
91+
- Tests/int_modulus_err.som
92+
93+
- Tests/load_string.som
94+
95+
- Tests/mutate_fields.som
96+
- Tests/mutate_methods.som
97+
- Tests/mutate_superclass_method/test.som
98+
99+
- Tests/nested_backtrace1.som
100+
- Tests/nested_backtrace2.som
101+
102+
- Tests/obj2.som
103+
104+
- Tests/perform_string.som
105+
- Tests/perform_witharguments_wrong.som
106+
107+
# - Tests/positive_infinity.som
108+
109+
- Tests/remainder_zero.som
110+
- Tests/round.som
111+
112+
- Tests/shift_right.som
113+
- Tests/shift_right_too_big.som
114+
- Tests/shift_right_type_err.som
115+
116+
- Tests/str_escape_unknown.som
117+
118+
- Tests/system2.som
119+
- Tests/system_global_lookup_string.som
120+
- Tests/system_global_put_string.som
121+
122+
- Tests/test_literals_limit_1.som
123+
- Tests/test_literals_limit_2.som
124+
- Tests/unknown_field_write.som
125+
126+
# methods array should be specified as being unstable
127+
- Tests/hashcode.som
128+
129+
# specify true, false, nil as literals, not globals
130+
- Tests/system_global.som
131+
132+
133+
unsupported:
134+
# to be implemented
135+
- Tests/binary_super.som
136+
- Tests/bool4.som
137+
- Tests/bool5.som
138+
139+
# just broken
140+
- Tests/perform_in_superclass_with_args.som
141+
142+
143+
do_not_run: []

integration-tests-bc.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
known_failures: []
2+
3+
4+
failing_as_unspecified:
5+
- Tests/arbint_double_div_err.som
6+
- Tests/arbint_double_div_zero_err.som
7+
- Tests/arbint_modulus_err.som
8+
- Tests/array_at_idx0_err.som
9+
- Tests/array_at_idx2_err.som
10+
- Tests/array_at_idx_err.som
11+
- Tests/array_at_negative_idx_err.som
12+
- Tests/array_at_put_idx0_err.som
13+
- Tests/array_at_put_idx2_err.som
14+
- Tests/call2.som
15+
16+
# I think this one is about E vs e, but maybe also double rendering
17+
- Tests/double2.som
18+
- Tests/double_double_div.som
19+
- Tests/int_double_div.som
20+
# - Tests/integer_asdouble.som
21+
- Tests/int26.som
22+
23+
# I think IEEE allows for infinities here, and we probably want that
24+
- Tests/double3.som
25+
- Tests/double4.som
26+
- Tests/double5.som
27+
- Tests/double6.som
28+
- Tests/double7.som
29+
- Tests/double8.som
30+
- Tests/double9.som
31+
- Tests/double11.som
32+
- Tests/double13.som
33+
34+
# Java seems to do some rounding in the transition, but it's also requiring bigints
35+
- Tests/double_asinteger.som
36+
37+
38+
- Tests/double_double_div_err.som
39+
- Tests/double_double_div_zero_err1.som
40+
- Tests/double_double_div_zero_err2.som
41+
- Tests/double_double_div_zero_err3.som
42+
- Tests/double_double_div_zero_err4.som
43+
- Tests/double_modulus.som
44+
- Tests/double_modulus_err.som
45+
46+
- Tests/exit_double.som
47+
- Tests/exit_int_too_big.som
48+
- Tests/exit_string.som
49+
50+
- Tests/fromstring_double_err.som
51+
- Tests/fromstring_err.som
52+
53+
- Tests/hashcode2.som
54+
55+
- Tests/inst_var_at_bad_idx.som
56+
- Tests/inst_var_at_put_bad_idx.som
57+
58+
- Tests/instance_fields_overlap/test.som
59+
- Tests/instance_fields_overlap2.som
60+
61+
- Tests/int5.som
62+
- Tests/int8.som
63+
- Tests/int9.som
64+
65+
- Tests/int10.som
66+
- Tests/int11.som
67+
- Tests/int12.som
68+
- Tests/int13.som
69+
- Tests/int14.som
70+
- Tests/int15.som
71+
- Tests/int16.som
72+
- Tests/int17.som
73+
74+
# too large shifts would take too much memory to support
75+
# need to specify this some how
76+
- Tests/int20.som
77+
- Tests/int21.som
78+
- Tests/int22.som
79+
- Tests/int23.som
80+
- Tests/int25.som
81+
- Tests/int27.som
82+
- Tests/int28.som
83+
- Tests/int31.som
84+
85+
# return type of sqrt
86+
- Tests/int29.som
87+
88+
- Tests/int_double_div_err.som
89+
- Tests/int_double_div_zero_err.som
90+
- Tests/int_modulus.som
91+
- Tests/int_modulus_err.som
92+
93+
- Tests/load_string.som
94+
95+
- Tests/mutate_fields.som
96+
- Tests/mutate_methods.som
97+
- Tests/mutate_superclass_method/test.som
98+
99+
- Tests/nested_backtrace1.som
100+
- Tests/nested_backtrace2.som
101+
102+
- Tests/obj2.som
103+
104+
- Tests/perform_string.som
105+
- Tests/perform_witharguments_wrong.som
106+
107+
# - Tests/positive_infinity.som
108+
109+
- Tests/remainder_zero.som
110+
- Tests/round.som
111+
112+
- Tests/shift_right.som
113+
- Tests/shift_right_too_big.som
114+
- Tests/shift_right_type_err.som
115+
116+
- Tests/str_escape_unknown.som
117+
118+
- Tests/system2.som
119+
- Tests/system_global_lookup_string.som
120+
- Tests/system_global_put_string.som
121+
122+
- Tests/test_literals_limit_1.som
123+
- Tests/test_literals_limit_2.som
124+
- Tests/unknown_field_write.som
125+
126+
# methods array should be specified as being unstable
127+
- Tests/hashcode.som
128+
129+
# specify true, false, nil as literals, not globals
130+
- Tests/system_global.som
131+
132+
133+
unsupported:
134+
# to be implemented
135+
- Tests/binary_super.som
136+
- Tests/binary_super/test.som
137+
# - Tests/bool4.som
138+
# - Tests/bool5.som
139+
140+
# just broken
141+
- Tests/perform_in_superclass_with_args.som
142+
143+
- Tests/int4.som
144+
- Tests/to32bits.som
145+
146+
do_not_run: []

src/trufflesom/src/trufflesom/primitives/arithmetic/BitXorPrim.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package trufflesom.primitives.arithmetic;
22

3+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
34
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
45
import com.oracle.truffle.api.dsl.Specialization;
56

67
import trufflesom.bdt.primitives.Primitive;
78
import trufflesom.vm.SymbolTable;
89
import trufflesom.vmobjects.SSymbol;
910

11+
import java.math.BigInteger;
12+
1013

1114
@GenerateNodeFactory
1215
@Primitive(className = "Integer", primitive = "bitXor:", selector = "bitXor:")
@@ -16,6 +19,24 @@ public static final long doLong(final long receiver, final long right) {
1619
return receiver ^ right;
1720
}
1821

22+
@Specialization
23+
@TruffleBoundary
24+
public static final BigInteger doBigInt(final BigInteger receiver, final long right) {
25+
return receiver.xor(BigInteger.valueOf(right));
26+
}
27+
28+
@Specialization
29+
@TruffleBoundary
30+
public static final BigInteger doBigInt(final BigInteger receiver, final BigInteger right) {
31+
return receiver.xor(right);
32+
}
33+
34+
@Specialization
35+
@TruffleBoundary
36+
public static final BigInteger doLong(final long receiver, final BigInteger right) {
37+
return BigInteger.valueOf(receiver).xor(right);
38+
}
39+
1940
@Override
2041
public final SSymbol getSelector() {
2142
return SymbolTable.symbolFor("bitXor:");

src/trufflesom/src/trufflesom/primitives/arithmetic/GreaterThanOrEqualPrim.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public static final boolean doLong(final long left, final BigInteger right) {
3434

3535
@Specialization
3636
public static final boolean doLong(final long left, final double right) {
37-
return doDouble(left, right);
37+
return left >= right;
3838
}
3939

4040
@Specialization
4141
public static final boolean doDouble(final double left, final long right) {
42-
return doDouble(left, right);
42+
return left >= right;
4343
}
4444

4545
@Specialization

src/trufflesom/src/trufflesom/primitives/arithmetic/LessThanOrEqualPrim.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static final boolean doLong(final long left, final long right) {
2828

2929
@Specialization
3030
public static final boolean doLong(final long left, final double right) {
31-
return doDouble(left, right);
31+
return left <= right;
3232
}
3333

3434
@Specialization
@@ -56,6 +56,6 @@ public static final boolean doDouble(final double left, final double right) {
5656

5757
@Specialization
5858
public static final boolean doDouble(final double left, final long right) {
59-
return doDouble(left, right);
59+
return left <= right;
6060
}
6161
}

0 commit comments

Comments
 (0)