This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271453 - Test action fails with 'mkdir: Command not found'
Summary: Test action fails with 'mkdir: Command not found'
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.2
Hardware: PC Windows 10 x64
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-09 18:26 UTC by haibane_tenshi
Modified: 2017-09-11 07:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description haibane_tenshi 2017-09-09 18:26:15 UTC
I use NetBeans 8.2 with NBCndUnit plugin to create tests. Also I use clang toolchain acquired through msys2. GoogleTest library and headers are acquired the same way.

How to reproduce the issue:

1. Create a new c++ project 'HelloWorld'

2. Create a new file 'main.cpp':

#include <iostream>

using namespace std;

int main(int argc, char** argv) {
	cout<<"Hello, world!";
	return 0;
}

3. Create a new "Test Folder 1" in Test Folder logical folder (context menu -> "New Test Folder...")

4. Add a new 'GoogleTest Test Suite...' (through wizard or context menu). Leave settings at defaults. It will create file with name 'TestSuite.cpp'

5. Open 'TestSuite.cpp' and add at the end

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

Main function is required for the test to properly compile (it is not generated automatically).

6. Right-click on "New test 1" folder and open properties. There add '-lgtest' to linker options.

7. Run 'Test Project' action.

The output looks like (it's getting cleared 2 times before that, no idea how to capture that)

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MSYS2-Clang-x64-Windows/helloworld.exe
make[2]: Entering directory '/d/Projects/HelloWorld'
mkdir -p dist/Debug/MSYS2-Clang-x64-Windows
make[2]: Leaving directory '/d/Projects/HelloWorld'
make[1]: Leaving directory '/d/Projects/HelloWorld'
make[2]: mkdir: Command not found
make[2]: *** [nbproject/Makefile-Debug.mk:72: dist/Debug/MSYS2-Clang-x64-Windows/helloworld.exe] Error 127
make[1]: *** [nbproject/Makefile-Debug.mk:69: .build-conf] Error 2
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2


Missing mkdir implies environment wasn't created correctly for the action, but it is definitely not the issue with toolchain or settings as it does compile through a normal action ('Build Project'):

cd 'D:\Projects\HelloWorld'
d:\SDK\msys2\usr\bin\make.exe -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MSYS2-Clang-x64-Windows/helloworld.exe
make[2]: Entering directory '/d/Projects/HelloWorld'
mkdir -p build/Debug/MSYS2-Clang-x64-Windows
rm -f "build/Debug/MSYS2-Clang-x64-Windows/main.o.d"
clang++    -c -g -MMD -MP -MF "build/Debug/MSYS2-Clang-x64-Windows/main.o.d" -o build/Debug/MSYS2-Clang-x64-Windows/main.o main.cpp
mkdir -p dist/Debug/MSYS2-Clang-x64-Windows
clang++     -o dist/Debug/MSYS2-Clang-x64-Windows/helloworld build/Debug/MSYS2-Clang-x64-Windows/main.o 
make[2]: Leaving directory '/d/Projects/HelloWorld'
make[1]: Leaving directory '/d/Projects/HelloWorld'

BUILD SUCCESSFUL (total time: 1s)



More than that, simply running 'make test' in a shell (msys2) succeeds:

$ make test
"make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
"make"  -f nbproject/Makefile-Debug.mk dist/Debug/MSYS2-Clang-x64-Windows/helloworld.exe
make[2]: Entering directory '/d/Projects/HelloWorld'
mkdir -p build/Debug/MSYS2-Clang-x64-Windows
rm -f "build/Debug/MSYS2-Clang-x64-Windows/main.o.d"
clang++    -c -g -MMD -MP -MF "build/Debug/MSYS2-Clang-x64-Windows/main.o.d" -o build/Debug/MSYS2-Clang-x64-Windows/main.o main.cpp
mkdir -p dist/Debug/MSYS2-Clang-x64-Windows
clang++     -o dist/Debug/MSYS2-Clang-x64-Windows/helloworld build/Debug/MSYS2-Clang-x64-Windows/main.o
make[2]: Leaving directory '/d/Projects/HelloWorld'
make[1]: Leaving directory '/d/Projects/HelloWorld'
"make" -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-tests-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
"make"  -f nbproject/Makefile-Debug.mk dist/Debug/MSYS2-Clang-x64-Windows/helloworld.exe
make[2]: Entering directory '/d/Projects/HelloWorld'
mkdir -p dist/Debug/MSYS2-Clang-x64-Windows
clang++     -o dist/Debug/MSYS2-Clang-x64-Windows/helloworld build/Debug/MSYS2-Clang-x64-Windows/main.o
make[2]: Leaving directory '/d/Projects/HelloWorld'
mkdir -p build/Debug/MSYS2-Clang-x64-Windows/tests
rm -f "build/Debug/MSYS2-Clang-x64-Windows/tests/TestSuite.o.d"
clang++    -c -g -I. -MMD -MP -MF "build/Debug/MSYS2-Clang-x64-Windows/tests/TestSuite.o.d" -o build/Debug/MSYS2-Clang-x64-Windows/tests/TestSuite.o TestSuite.cpp
mkdir -p build/Debug/MSYS2-Clang-x64-Windows
0000000000000050 T main
mkdir -p build/Debug/MSYS2-Clang-x64-Windows/tests/TestFiles
clang++     -o build/Debug/MSYS2-Clang-x64-Windows/tests/TestFiles/f1 build/Debug/MSYS2-Clang-x64-Windows/tests/TestSuite.o build/Debug/MSYS2-Clang-x64-Windows/main_nomain.o   -lgtest
make[1]: Leaving directory '/d/Projects/HelloWorld'
"make" -f nbproject/Makefile-Debug.mk SUBPROJECTS= .test-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TestSuite
[ RUN      ] TestSuite.testExample
TestSuite.cpp:15: Failure
Failed
[  FAILED  ] TestSuite.testExample (1 ms)
[----------] 1 test from TestSuite (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] TestSuite.testExample

 1 FAILED TEST
make[1]: Leaving directory '/d/Projects/HelloWorld'



So it's safe to assume makefiles were generated correctly. No idea who's to blame, IDE or plugin, so posted it here.
Comment 1 haibane_tenshi 2017-09-09 18:41:19 UTC
Can confirm the same result for the other testing frameworks (not only ones supported by NBCndUnit). 

For example, adding a new test via context menu -> 'New C++ Simple Test...' and then running it by 'Test Project' action leads to exact same result ('mkdir: Command not found'). 'make test' works too:

$ make test
"make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
"make"  -f nbproject/Makefile-Debug.mk dist/Debug/MSYS2-Clang-x64-Windows/helloworld.exe
make[2]: Entering directory '/d/Projects/HelloWorld'
mkdir -p dist/Debug/MSYS2-Clang-x64-Windows
clang++     -o dist/Debug/MSYS2-Clang-x64-Windows/helloworld build/Debug/MSYS2-Clang-x64-Windows/main.o
make[2]: Leaving directory '/d/Projects/HelloWorld'
make[1]: Leaving directory '/d/Projects/HelloWorld'
"make" -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-tests-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
"make"  -f nbproject/Makefile-Debug.mk dist/Debug/MSYS2-Clang-x64-Windows/helloworld.exe
make[2]: Entering directory '/d/Projects/HelloWorld'
mkdir -p dist/Debug/MSYS2-Clang-x64-Windows
clang++     -o dist/Debug/MSYS2-Clang-x64-Windows/helloworld build/Debug/MSYS2-Clang-x64-Windows/main.o
make[2]: Leaving directory '/d/Projects/HelloWorld'
make[1]: Leaving directory '/d/Projects/HelloWorld'
"make" -f nbproject/Makefile-Debug.mk SUBPROJECTS= .test-conf
make[1]: Entering directory '/d/Projects/HelloWorld'
%SUITE_STARTING% newsimpletest
%SUITE_STARTED%
%TEST_STARTED% test1 (newsimpletest)
newsimpletest test 1
%TEST_FINISHED% time=0 test1 (newsimpletest)
%TEST_STARTED% test2 (newsimpletest)

newsimpletest test 2
%TEST_FAILED% time=0 testname=test2 (newsimpletest) message=error message sample
%TEST_FINISHED% time=0 test2 (newsimpletest)
%SUITE_FINISHED% time=0
make[1]: Leaving directory '/d/Projects/HelloWorld'