/* * Copyright (c) 2016, Oracle and/or its affiliates. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.oracle.truffle.llvm.test.interop; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; import java.nio.file.Path; import org.junit.Test; import com.oracle.truffle.api.source.Source; import com.oracle.truffle.api.vm.PolyglotEngine; import com.oracle.truffle.api.vm.PolyglotEngine.Builder; import com.oracle.truffle.llvm.Sulong; import com.oracle.truffle.llvm.runtime.options.LLVMOptions; import com.oracle.truffle.tck.TruffleTCK; public class LLVMTckTest extends TruffleTCK { private static final String FILENAME = "tck"; private static final Path TEST_DIR = new File(LLVMOptions.ENGINE.projectRoot() + "/../cache/tests/interoptests").toPath(); private static final String FILE_SUFFIX = "_clang_v38_O0_MEM2REG.bc"; @Test public void testVerifyPresence() { PolyglotEngine vm = PolyglotEngine.newBuilder().build(); assertTrue("Our language is present", vm.getLanguages().containsKey(Sulong.LLVM_BITCODE_MIME_TYPE)); vm.dispose(); } @Override protected PolyglotEngine prepareVM(Builder builder) throws Exception { PolyglotEngine engine = builder.build(); try { File file = new File(TEST_DIR.toFile(), "/" + FILENAME + "/" + FILENAME + FILE_SUFFIX); engine.eval(Source.newBuilder(file).build()).as(Integer.class); } catch (IOException e) { throw new AssertionError(e); } return engine; } @Override protected String mimeType() { return Sulong.LLVM_BITCODE_MIME_TYPE; } @Override protected String fourtyTwo() { return "fourtyTwo"; } @Override protected String identity() { return "identity"; } @Override protected String plus(Class<?> type1, Class<?> type2) { return "plus"; } @Override protected String returnsNull() { return "returnsNull"; } @Override protected String applyNumbers() { return "apply"; } @Override protected String compoundObject() { return "compoundObject"; } @Override protected String valuesObject() { return "valuesObject"; } @Override protected String complexAdd() { return "complexAdd"; } @Override protected String countInvocations() { return "count"; } @Override protected String addToArray() { return "addToArray"; } @Override protected String countUpWhile() { return "countUpWhile"; } @Override protected String globalObject() { return null; } @Override protected String evaluateSource() { return null; } @Override protected String complexCopy() { return "complexCopy"; } @Override protected String complexAddWithMethod() { return "complexAddWithMethod"; } @Override protected String complexSumReal() { return "complexSumReal"; } // Disabled failing tests: no structs, no function passing and other unimplemented functionality @Override public void testValueWithSource() throws Exception { } @Override public void testMetaObject() throws Exception { } @Override public void testRootNodeName() throws Exception { } @Override public void testPropertiesInteropMessage() throws Exception { } @Override public void testSumRealOfComplexNumbersAsStructuredDataRowBased() throws Exception { } @Override public void testSumRealOfComplexNumbersAsStructuredDataColumnBased() throws Exception { } @Override public void testSumRealOfComplexNumbersA() throws Exception { } @Override public void testSumRealOfComplexNumbersB() throws Exception { } @Override public void testCopyComplexNumbersA() throws Exception { } @Override public void testCopyComplexNumbersB() throws Exception { } @Override public void testCopyStructuredComplexToComplexNumbersA() throws Exception { } @Override public void testAddComplexNumbersWithMethod() throws Exception { } @Override public void testInvalidTestMethod() throws Exception { throw new Exception(); } // ... and some other strange behavior @Override public void multiplyTwoVariables() throws Exception { } @Override public void testNullInCompoundObject() throws Exception { } @Override public void testFortyTwoWithCompoundObject() throws Exception { } @Override public void testPlusWithIntsOnCompoundObject() throws Exception { } @Override public void readWriteBooleanValue() throws Exception { } @Override public void readWriteByteValue() throws Exception { } @Override public void readWriteShortValue() throws Exception { } @Override public void readWriteCharValue() throws Exception { } @Override public void readWriteIntValue() throws Exception { } @Override public void readWriteFloatValue() throws Exception { } @Override public void readWriteDoubleValue() throws Exception { } @Override public void testPrimitiveReturnTypeByte() throws Exception { } @Override public void testPrimitiveReturnTypeShort() throws Exception { } @Override public void testPrimitiveReturnTypeInt() throws Exception { } @Override public void testPrimitiveReturnTypeLong() throws Exception { } @Override public void testPrimitiveReturnTypeFloat() throws Exception { } @Override public void testPrimitiveReturnTypeDouble() throws Exception { } @Override public void testEvaluateSource() throws Exception { } @Override public void timeOutTest() throws Exception { } @Override public void testCoExistanceOfMultipleLanguageInstances() throws Exception { } @Override public void testFunctionAddNumbers() throws Exception { } @Override public void testWriteValueToForeign() throws Exception { } @Override public void testReadValueFromForeign() throws Exception { } @Override public void testObjectWithValueAndAddProperty() throws Exception { } @Override public void testIsExecutableOfForeign() throws Exception { } @Override public void testCallMethod() throws Exception { } @Override public void testHasSizeOfForeign() throws Exception { } @Override public void testHasSize() throws Exception { } @Override public void testGetSize() throws Exception { } @Override public void testIsExecutable() throws Exception { } @Override public void testWriteElementOfForeign() throws Exception { } @Override public void testIsNullOfForeign() throws Exception { } @Override public void testReadFromObjectWithElement() throws Exception { } @Override public void testWriteToObjectWithElement() throws Exception { } @Override public void testCallFunction() throws Exception { } @Override public void testReadElementFromForeign() throws Exception { } @Override public void testReadFromObjectWithValueProperty() throws Exception { } @Override public void testWriteToObjectWithValueProperty() throws Exception { } @Override public void testIsNotNull() throws Exception { } @Override public void testGetSizeOfForeign() throws Exception { } @Override public void testObjectWithKeyInfoAttributes() throws Exception { } @Override protected String invalidCode() { return null; } }