Skip to content

Commit 74ec512

Browse files
assert that opencv version matches version passed to build script + fixed default include dir
1 parent 6dcbc17 commit 74ec512

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

ci/test/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
image=opencv4nodejs-ci:$1-node$2
33
docker build -t $image -f ./Dockerfile --build-arg TAG=$1 --build-arg NODE_MAJOR_VERSION=$2 ../../
4-
docker run -e TEST_MODULE_LIST=$TEST_MODULE_LIST $image
4+
docker run -e OPENCV_VERSION=$OPENCV_VERSION -e TEST_MODULE_LIST=$TEST_MODULE_LIST $image

install/install.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function getDefaultIncludeDirs() {
1414
if (opencvBuild.isWin()) {
1515
throw new Error('OPENCV_INCLUDE_DIR has to be defined on windows when auto build is disabled')
1616
}
17-
return [defaultLibDir, defaultIncludeDirOpenCV4]
17+
return [defaultIncludeDir, defaultIncludeDirOpenCV4]
1818
}
1919

2020
function getDefaultLibDir() {
@@ -68,10 +68,10 @@ log.info('install', 'setting the following defines:')
6868
defines.forEach(def => log.info('defines', def))
6969
console.log()
7070
log.info('install', 'setting the following includes:')
71-
includes.forEach(def => log.info('includes', def))
71+
includes.forEach(inc => log.info('includes', inc))
7272
console.log()
7373
log.info('install', 'setting the following libs:')
74-
libs.forEach(def => log.info('libs', def))
74+
libs.forEach(lib => log.info('libs', lib))
7575

7676
process.env['OPENCV4NODEJS_DEFINES'] = defines.join('\n')
7777
process.env['OPENCV4NODEJS_INCLUDES'] = includes.join('\n')

test/tests/index.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,21 @@ describe('cv', () => {
6464
builtModules = builtModules.filter(m => m !== 'dnn')
6565
}
6666

67+
const opencvVersionString = `${cv.version.major}.${cv.version.minor}.${cv.version.revision}`
68+
69+
console.log('envs are:')
70+
console.log('OPENCV_VERSION:', process.env.OPENCV_VERSION)
71+
console.log('TEST_MODULE_LIST:', process.env.TEST_MODULE_LIST)
72+
console.log('APPVEYOR_BUILD:', process.env.APPVEYOR_BUILD)
73+
console.log()
74+
console.log('OpenCV version is:', opencvVersionString)
6775
console.log('compiled with the following modules:', cv.modules)
6876
console.log('expected modules to be built:', builtModules)
6977

78+
it('OpenCV version should match', () => {
79+
expect(process.env.OPENCV_VERSION).to.equal(opencvVersionString)
80+
})
81+
7082
it('all modules should be built', () => {
7183
builtModules.forEach(m => expect(cv.modules).to.have.property(m));
7284
})

0 commit comments

Comments
 (0)