@ForAllEnvironments public void testNonProjectUpdates() throws Exception { final ExecutionEnvironment execEnv = getTestExecutionEnvironment(); MakeProject makeProject = openProject("TestNonProjectUpdates", execEnv, Sync.RFS, Toolchain.GNU); changeProjectHost(makeProject, execEnv); buildProject( makeProject, ActionProvider.COMMAND_BUILD, getSampleBuildTimeout(), TimeUnit.SECONDS); File projectDirFile = CndFileUtils.toFile(makeProject.getProjectDirectory()); NameStatePair[] filesToCheck = new NameStatePair[] { new NameStatePair( new File(projectDirFile, "file_1.c"), FileDownloadInfo.State.UNCONFIRMED), new NameStatePair( new File(projectDirFile, "file_1.cc"), FileDownloadInfo.State.UNCONFIRMED), new NameStatePair( new File(projectDirFile, "file_1.cpp"), FileDownloadInfo.State.UNCONFIRMED), new NameStatePair( new File(projectDirFile, "file_1.cxx"), FileDownloadInfo.State.UNCONFIRMED), new NameStatePair( new File(projectDirFile, "file_1.h"), FileDownloadInfo.State.UNCONFIRMED), new NameStatePair( new File(projectDirFile, "file_1.hpp"), FileDownloadInfo.State.UNCONFIRMED) // new NameStatePair(new File(projectDirFile, "Makefile"), // FileDownloadInfo.State.UNCONFIRMED) }; checkInfo(filesToCheck, 12000, RemoteProjectSupport.getPrivateStorage(makeProject)); }
@Override protected void buildProject(MakeProject makeProject, String command, long timeout, TimeUnit unit) throws Exception { try { super.buildProject(makeProject, command, timeout, unit); } catch (AssertionFailedError ex) { String localProjectDir = makeProject.getProjectDirectory().getPath(); String remoteProjectDir = RemotePathMap.getPathMap(getTestExecutionEnvironment()) .getRemotePath(localProjectDir, false); String zipName = "__rfs_remote_project__.zip"; String remoteZip = remoteProjectDir + "/" + zipName; String localZip = localProjectDir + "/" + zipName; ExitStatus res = ProcessUtils.executeInDir( remoteProjectDir, getTestExecutionEnvironment(), "zip", "-r", "-q", remoteZip, "."); if (res.isOK()) { int rc = CommonTasksSupport.downloadFile( remoteZip, getTestExecutionEnvironment(), localZip, null) .get(); if (rc == 0) { System.err.printf("Remote project content copied to %s\n", localZip); } else { System.err.printf("Error downloading remote project content\n"); } } else { System.err.printf( "Can not download remote project: rc=%d err=%s\n", res.exitCode, res.error); } throw ex; } }
@ForAllEnvironments public void test_LexYacc_BuildLocalAndRemote() throws Exception { MakeProject makeProject = prepareSampleProject(Sync.RFS, Toolchain.GNU, "LexYacc", "LexYacc_Build"); int timeout = getSampleBuildTimeout(); changeProjectHost(makeProject, ExecutionEnvironmentFactory.getLocal()); buildProject(makeProject, ActionProvider.COMMAND_BUILD, timeout, TimeUnit.SECONDS); changeProjectHost(makeProject, getTestExecutionEnvironment()); File token_l = new File(CndFileUtils.toFile(makeProject.getProjectDirectory()), "token.l"); token_l.setLastModified(System.currentTimeMillis() + 2000); File token_y = new File(CndFileUtils.toFile(makeProject.getProjectDirectory()), "token.y"); token_y.setLastModified(System.currentTimeMillis() + 2000); buildProject(makeProject, ActionProvider.COMMAND_BUILD, timeout, TimeUnit.SECONDS); // Bug #182762 - Second clean & build for LexYacc build on remote host fails buildProject(makeProject, ActionProvider.COMMAND_CLEAN, timeout, TimeUnit.SECONDS); buildProject(makeProject, ActionProvider.COMMAND_BUILD, timeout, TimeUnit.SECONDS); }
@ForAllEnvironments public void test_LexYacc_Updates() throws Exception { MakeProject makeProject = prepareSampleProject(Sync.RFS, Toolchain.GNU, "LexYacc", "LexYacc_Updates"); int timeout = getSampleBuildTimeout(); buildProject(makeProject, ActionProvider.COMMAND_CLEAN, timeout, TimeUnit.SECONDS); buildProject(makeProject, ActionProvider.COMMAND_BUILD, timeout, TimeUnit.SECONDS); File projectDirFile = CndFileUtils.toFile(makeProject.getProjectDirectory()); NameStatePair[] filesToCheck = new NameStatePair[] { new NameStatePair( new File(projectDirFile, "y.tab.c"), FileDownloadInfo.State.UNCONFIRMED), new NameStatePair( new File(projectDirFile, "y.tab.h"), FileDownloadInfo.State.UNCONFIRMED), new NameStatePair( new File(projectDirFile, "lex.yy.c"), FileDownloadInfo.State.UNCONFIRMED) }; checkInfo(filesToCheck, 10000, RemoteProjectSupport.getPrivateStorage(makeProject)); }