1 /*
2 * #%L
3 * Native ARchive plugin for Maven
4 * %%
5 * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6 * %%
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * #L%
19 */
20 package com.github.maven_nar.cpptasks.msvc;
21
22 import java.io.File;
23
24 /**
25 * Test for Microsoft Developer Studio linker
26 *
27 * Override create to test concrete compiler implementions
28 */
29 public class TestInstalledMsvcLinker extends TestMsvcLinker {
30 public TestInstalledMsvcLinker(final String name) {
31 super(name);
32 }
33
34 public void failingtestGetLibraryPath() {
35 final File[] libpath = MsvcLinker.getInstance().getLibraryPath();
36 //
37 // unless you tweak the library path
38 // it should have more thean three entries
39 assertTrue(libpath.length >= 2);
40 //
41 // check if these files can be found
42 //
43 final String[] libnames = new String[] {
44 "kernel32.lib", "advapi32.lib", "msvcrt.lib", "mfc42.lib", "mfc70.lib"
45 };
46 final boolean[] libfound = new boolean[libnames.length];
47 for (final File element : libpath) {
48 for (int j = 0; j < libnames.length; j++) {
49 final File libfile = new File(element, libnames[j]);
50 if (libfile.exists()) {
51 libfound[j] = true;
52 }
53 }
54 }
55 assertTrue("kernel32 not found", libfound[0]);
56 assertTrue("advapi32 not found", libfound[1]);
57 assertTrue("msvcrt not found", libfound[2]);
58 if (!(libfound[3] || libfound[4])) {
59 fail("mfc42.lib or mfc70.lib not found");
60 }
61 }
62 }