Skip to content

Commit

Permalink
Implement SqueakSSL Primitives (#16)
Browse files Browse the repository at this point in the history
* Implement SqueakSSL primitives (#3)
* Cleanups and improvements for SqueakSSL project
* Add .mx cache to .gitignore
* Set Java compliance property to '8+'

This fixes the following behavior:
When trying to reproduce a test failure which
occurred on JDK 11 only, I set JAVA_HOME
accordingly and ran "mx unittest". However,
test discovery yielded no tests, because
no modules where found that fit the Java
version (given the previous configuration
value of '1.8').

Also, when having building with both
JDK 8 and 11 on CI, '8+' is likely the
logical compliance value that fits the
project setup best.
  • Loading branch information
f4lco authored and fniephaus committed Jan 14, 2019
1 parent 1e087af commit 69fabdd
Show file tree
Hide file tree
Showing 9 changed files with 1,283 additions and 255 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ coverage
env
images
jacoco.exec
.mx
mx
mxbuild
workingsets.xml
Expand Down
22 changes: 16 additions & 6 deletions mx.graalsqueak/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,31 @@
}],
},

"libraries": {},
"libraries": {
"BOUNCY_CASTLE_CRYPTO_LIB": {
"sha1": "bd47ad3bd14b8e82595c7adaa143501e60842a84",
"maven": {
"groupId": "org.bouncycastle",
"artifactId": "bcprov-jdk15on",
"version": "1.60"
}
},
},

"projects": {
"de.hpi.swa.graal.squeak": {
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": [
"BOUNCY_CASTLE_CRYPTO_LIB",
"graalsqueak:GRAALSQUEAK-SHARED",
"truffle:TRUFFLE_API",
"truffle:TRUFFLE_DSL_PROCESSOR",
],
"checkstyle": "de.hpi.swa.graal.squeak",
"checkstyleVersion": "8.8",
"jacoco": "include",
"javaCompliance": "1.8",
"javaCompliance": "8+",
"annotationProcessors": ["truffle:TRUFFLE_DSL_PROCESSOR"],
"workingSets": "GraalSqueak",
},
Expand All @@ -45,7 +55,7 @@
"checkstyle": "de.hpi.swa.graal.squeak",
"checkstyleVersion": "8.8",
"jacoco": "include",
"javaCompliance": "1.8",
"javaCompliance": "8+",
"workingSets": "GraalSqueak",
},
"de.hpi.swa.graal.squeak.shared": {
Expand All @@ -57,7 +67,7 @@
"checkstyle": "de.hpi.swa.graal.squeak",
"checkstyleVersion": "8.8",
"jacoco": "include",
"javaCompliance": "1.8",
"javaCompliance": "8+",
"workingSets": "GraalSqueak",
},
"de.hpi.swa.graal.squeak.test": {
Expand All @@ -66,7 +76,7 @@
"dependencies": ["de.hpi.swa.graal.squeak", "mx:JUNIT"],
"checkstyle": "de.hpi.swa.graal.squeak",
"jacoco": "include",
"javaCompliance": "1.8",
"javaCompliance": "8+",
"workingSets": "GraalSqueak",
},
},
Expand Down Expand Up @@ -131,7 +141,7 @@

"GRAALSQUEAK_TEST": {
"path": "graalsqueak_test.jar",
"javaCompliance": "1.8",
"javaCompliance": "8+",
"dependencies": [
"de.hpi.swa.graal.squeak.test",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3652,19 +3652,33 @@ SqNumberParserTest>>testNew=passing
SqNumberParserTest>>testScaledDecimalWithImplicitScale=passing
SqNumberParserTest>>testScaledDecimalWithTrailingZeroes=passing
SqNumberParserTest>>testUnCategorizedMethods=passing
SqueakSSLTest>>testConnectAccept=failing
SqueakSSLTest>>testEncryptDecrypt=failing
SqueakSSLTest>>testFaceBookAPI=failing
SqueakSSLTest>>testGooglePopStream=failing
SqueakSSLTest>>testMultiFrameDecrypt=failing
SqueakSSLTest>>testSingleByteDecrypt=failing
SqueakSSLTest>>testSocketAccept=failing
SqueakSSLTest>>testSocketConnect=failing
SqueakSSLTest>>testSplitTlsFrameRead=failing
SqueakSSLTest>>testSSLSockets=failing
SqueakSSLTest>>testStreamAccept=failing
SqueakSSLTest>>testStreamConnect=failing
SqueakSSLTest>>testStreamTransfer=failing
SqueakSSLTest>>testConnectAccept=passing
SqueakSSLTest>>testEncryptDecrypt=passing

# Broken test? I cannot figure out why failure is expected.
# self shouldnt: [ webClient httpGet: 'https://graph.facebook.com' ]
SqueakSSLTest>>testFaceBookAPI=broken_in_squeak

# Broken test, or changed requirements from Google, and JDK dependent.
# On JDK 11, the response indicates that SNI has to be used, however, the test does not supply the server name.
# Reference: test method: "stream sslConnect."
# Should rather be "stream sslConnect: '<whatever host name is expected>'."?
# Passing on JDK8, failing on JDK 11
SqueakSSLTest>>testGooglePopStream=flaky

SqueakSSLTest>>testMultiFrameDecrypt=passing
SqueakSSLTest>>testSingleByteDecrypt=passing

# may depend on socket plugin stability
SqueakSSLTest>>testSocketAccept=ignored
SqueakSSLTest>>testSocketConnect=ignored
SqueakSSLTest>>testSplitTlsFrameRead=ignored
SqueakSSLTest>>testSSLSockets=ignored

SqueakSSLTest>>testStreamAccept=ignored
SqueakSSLTest>>testStreamConnect=ignored
SqueakSSLTest>>testStreamTransfer=ignored

ST80MenusTest>>testSupplyAnswerOfFillInTheBlank=passing
ST80MenusTest>>testSupplySpecificAnswerToQuestion=passing
ST80MenusTest>>testSuppressInform=passing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,25 @@

public final class SqueakExceptions {

/*
/**
* Exception to signal an illegal state in GraalSqueak.
*/
public static final class SqueakException extends IllegalStateException {
private static final long serialVersionUID = 1L;

public SqueakException(final String message, final Throwable cause) {
super(message, cause);
CompilerDirectives.transferToInterpreter();
printSqueakStackTrace();
}

public SqueakException(final Object... messageParts) {
super(ArrayUtils.toJoinedString(" ", messageParts));
CompilerDirectives.transferToInterpreter();
printSqueakStackTrace();
}

private static void printSqueakStackTrace() {
final FrameInstance currentFrame = Truffle.getRuntime().getCurrentFrame();
if (currentFrame != null) {
final Frame frame = currentFrame.getFrame(FrameInstance.FrameAccess.READ_ONLY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import java.nio.channels.SeekableByteChannel;
import java.nio.file.StandardOpenOption;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.TruffleFile;
Expand Down Expand Up @@ -37,8 +35,10 @@
import de.hpi.swa.graal.squeak.nodes.primitives.SqueakPrimitive;
import de.hpi.swa.graal.squeak.util.ArrayConversionUtils;

import org.graalvm.collections.EconomicMap;

public final class FilePlugin extends AbstractPrimitiveFactoryHolder {
private static final Map<Long, SeekableByteChannel> files = new HashMap<>();
private static final EconomicMap<Long, SeekableByteChannel> FILES = EconomicMap.create();

public static final class STDIO_HANDLES {
public static final long IN = 0;
Expand All @@ -54,7 +54,7 @@ public List<? extends NodeFactory<? extends AbstractPrimitiveNode>> getFactories

@TruffleBoundary
private static SeekableByteChannel getFileOrPrimFail(final long fileDescriptor) {
final SeekableByteChannel handle = files.get(fileDescriptor);
final SeekableByteChannel handle = FILES.get(fileDescriptor);
if (handle == null) {
throw new PrimitiveFailed();
}
Expand Down Expand Up @@ -87,7 +87,7 @@ protected static Object createFileHandleOrPrimFail(final TruffleFile truffleFile
}
final SeekableByteChannel file = truffleFile.newByteChannel(options);
final long fileId = file.hashCode();
files.put(fileId, file);
FILES.put(fileId, file);
return fileId;
} catch (IOException | UnsupportedOperationException | SecurityException e) {
throw new PrimitiveFailed();
Expand Down
Loading

0 comments on commit 69fabdd

Please sign in to comment.