Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3627f73c700207d603b50d95280f94e6b7ea5de6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package org.eclipse.linuxtools.internal.valgrind.memcheck.tests;

import java.io.IOException;

import junit.framework.TestCase;

import org.eclipse.linuxtools.internal.valgrind.core.ValgrindCommand;
import org.eclipse.linuxtools.internal.valgrind.core.ValgrindPlugin;
import org.eclipse.linuxtools.internal.valgrind.core.ValgrindPreferencePage;
import org.eclipse.linuxtools.internal.valgrind.launch.ValgrindLaunchPlugin;


public class LocationPreferenceTest extends TestCase {

	private ValgrindCommand command = new ValgrindCommand() {
		protected void readIntoBuffer(StringBuffer out, Process p) throws IOException {
			// Simulate not finding Valgrind in the user's PATH
			throw new IOException();
		}
	};
	
	/**
	 * Tests Bug #315890 - Valgrind location cannot be overridden unless Valgrind is present in PATH
	 * @throws Exception
	 */
	public void testManualLocationNoPATH() throws Exception {
		// Set a preference for a manual location
		ValgrindPlugin.getDefault().getPreferenceStore().setValue(ValgrindPreferencePage.VALGRIND_PATH, "/path/to/valgrind");
		
		ValgrindLaunchPlugin.getDefault().setValgrindCommand(command);
		
		ValgrindLaunchPlugin.getDefault().getValgrindLocation();
	}
}

Back to the top