1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 552158 - Filter out commented lines in init and run comamnds

Change-Id: I46b9af07e5ee6de2986ef7ea99be9ee6e74b84fb
Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
This commit is contained in:
Torbjörn Svensson 2019-10-16 21:25:43 +02:00
parent 42daf203a6
commit 6bd29843f2
4 changed files with 16 additions and 5 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: GDB Hardware Debugging Tests
Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core.tests;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.0.100.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.tests.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.tests.dsf.gdb;bundle-version="2.3.0",

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.debug.gdbjtag.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2018 Kichwa Coders and others.
* Copyright (c) 2016, 2019 Kichwa Coders and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -67,8 +67,9 @@ public class GDBJtagLaunchTest extends BaseParametrizedTestCase {
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, X86_64_INIT);
}
} else {
setLaunchAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "file " + TEST_PROGRAM_NAME); //$NON-NLS-1$
setLaunchAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, "run"); //$NON-NLS-1$
String comments = "# Commented line\n\n \n # Commented indented line\n";
setLaunchAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, comments + "file " + TEST_PROGRAM_NAME); //$NON-NLS-1$
setLaunchAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, comments + "run"); //$NON-NLS-1$
}
}

View file

@ -489,6 +489,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
if (userCmd.length() > 0) {
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
// Remove empty or commented lines
commands = Arrays.stream(commands)
.filter(line -> !line.trim().isEmpty() && !line.trim().startsWith("#")) //$NON-NLS-1$
.toArray(String[]::new);
CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
crm.setDoneCount(commands.length);
for (int i = 0; i < commands.length; ++i) {
@ -715,6 +720,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
// Remove empty or commented lines
commands = Arrays.stream(commands)
.filter(line -> !line.trim().isEmpty() && !line.trim().startsWith("#")) //$NON-NLS-1$
.toArray(String[]::new);
CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
crm.setDoneCount(commands.length);
for (int i = 0; i < commands.length; ++i) {