chaokunyang commented on code in PR #2585: URL: https://github.com/apache/fory/pull/2585#discussion_r2338895139
########## java/fory-core/src/test/java/org/apache/fory/RustXlangTest.java: ########## @@ -0,0 +1,507 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.fory; + +import com.google.common.collect.ImmutableMap; +import com.google.common.hash.Hashing; +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import java.time.Instant; +import java.time.LocalDate; +import java.util.*; +import java.util.function.BiConsumer; +import java.util.stream.Collectors; +import lombok.Data; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.fory.config.CompatibleMode; +import org.apache.fory.config.Language; +import org.apache.fory.logging.Logger; +import org.apache.fory.logging.LoggerFactory; +import org.apache.fory.memory.MemoryBuffer; +import org.apache.fory.memory.MemoryUtils; +import org.apache.fory.serializer.StringSerializer; +import org.apache.fory.test.TestUtils; +import org.apache.fory.util.MurmurHash3; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** Tests in this class need fory python/rust installed. */ +@Test +public class RustXlangTest extends ForyTestBase { + private static final Logger LOG = LoggerFactory.getLogger(RustXlangTest.class); + private static final String PYTHON_EXECUTABLE = "python"; + private static final String PYTHON_MODULE = "pyfory.tests.test_cross_language"; + + private static final String RUST_EXECUTABLE = "cargo"; + private static final String RUST_MODULE = "test_cross_language"; + + private static final List<String> rustBaseCommand = + Arrays.asList( + RUST_EXECUTABLE, + "test", + "--test", + RUST_MODULE, + "<RUST_TESTCASE>", + "--", + // Use this to get output + "--nocapture", + // Run unittest that ignored in rust + "--ignored", + // Exact match test name rather than prefix matching. + "--exact"); + private static final List<String> pyBaseCommand = + Arrays.asList(PYTHON_EXECUTABLE, "-m", PYTHON_MODULE, "<TESTCASE>", "<DATA_FILE>"); + + private static final int RUST_TESTCASE_INDEX = 4; + + @BeforeClass + public void isPyforyInstalled() { + // TestUtils.verifyPyforyInstalled(); Review Comment: Please also update rust ci in `.github/workflows/ci.yaml` to install fory java too and run test command `mvn test -Dtest=org.apache.fory.RustXlangTest` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
