Skip to content

Commit 89bafa1

Browse files
committed
[SLT] Copy cargo.lock before running SLT tests
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
1 parent fe82ad1 commit 89bafa1

File tree

1 file changed

+14
-2
lines changed
  • sql-to-dbsp-compiler/slt/src/main/java/org/dbsp/sqllogictest

1 file changed

+14
-2
lines changed

sql-to-dbsp-compiler/slt/src/main/java/org/dbsp/sqllogictest/Main.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@
3030
import org.dbsp.sqllogictest.executors.DBSPExecutor;
3131
import org.dbsp.sqllogictest.executors.DbspJdbcExecutor;
3232
import org.dbsp.util.Linq;
33+
import org.dbsp.util.Utilities;
3334

3435
import java.io.*;
36+
import java.nio.file.Files;
37+
import java.nio.file.Path;
38+
import java.nio.file.StandardCopyOption;
3539
import java.time.LocalDate;
3640
import java.util.ArrayList;
3741
import java.util.Arrays;
@@ -73,7 +77,7 @@ public static void rotateTests() throws IOException, ClassNotFoundException {
7377

7478
String wd = System.getProperty("user.dir");
7579
File directory = new File(wd + "/..").getAbsoluteFile();
76-
System.setProperty("user.dir", directory.getAbsolutePath());
80+
System.setProperty("user.dir", directory.getCanonicalPath());
7781
wd = System.getProperty("user.dir");
7882
System.out.println("working directory is " + wd);
7983

@@ -141,7 +145,15 @@ public static void main(String[] argv) throws IOException, ClassNotFoundExceptio
141145
args = a.toArray(new String[0]);
142146
}
143147
System.out.println(Arrays.toString(args));
144-
System.out.println("WD: " + System.getProperty("user.dir"));
148+
String wd = System.getProperty("user.dir");
149+
System.out.println("WD: " + wd);
150+
Path source = Path.of(wd, "..", "Cargo.lock");
151+
File sourceFile = source.toFile().getCanonicalFile();
152+
Path destination = Path.of(wd, "temp", "Cargo.lock");
153+
File destinationFile = destination.toFile().getCanonicalFile();
154+
System.out.println("Copying " + sourceFile.getPath() + " to " + destinationFile.getPath());
155+
Utilities.enforce(sourceFile.exists());
156+
Files.copy(sourceFile.toPath(), destinationFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
145157
OptionsParser parser = new OptionsParser(true, System.out, System.err);
146158
parser.registerOption("-skip", "skipCount", "How many tests to skip (for debugging)", o -> {
147159
skip.set(Integer.parseInt(o));

0 commit comments

Comments
 (0)