Skip to content

Commit 85b0372

Browse files
committed
DISABLE some tests by default since they take long to run. They can be forced to run by --gtest_also_run_disabled_tests argument
1 parent a78bbd2 commit 85b0372

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

unittest/apiexample_test.cc

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
///////////////////////////////////////////////////////////////////////
22
// File: apiexample_test.cc
33
// Description: Api Test for Tesseract using text fixtures and parameters.
4+
// Tests for Devanagari, Latin and Arabic scripts are disabled by default.
5+
// Disabled tests can be run when required by using the --gtest_also_run_disabled_tests argument.
6+
// ./unittest/apiexample_test --gtest_also_run_disabled_tests
7+
//
48
// Author: ShreeDevi Kumar
59
//
610
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,7 +40,7 @@ class QuickTest : public testing::Test {
3640
}
3741
virtual void TearDown() {
3842
const time_t end_time = time(nullptr);
39-
EXPECT_TRUE(end_time - start_time_ <=25) << "The test took too long - " << ::testing::PrintToString(end_time - start_time_);
43+
EXPECT_TRUE(end_time - start_time_ <=55) << "The test took too long - " << ::testing::PrintToString(end_time - start_time_);
4044
}
4145
time_t start_time_;
4246
};
@@ -84,11 +88,11 @@ class QuickTest : public testing::Test {
8488

8589
INSTANTIATE_TEST_CASE_P( Eng, MatchGroundTruth,
8690
::testing::Values("eng") );
87-
INSTANTIATE_TEST_CASE_P( Latin, MatchGroundTruth,
91+
INSTANTIATE_TEST_CASE_P( DISABLED_Latin, MatchGroundTruth,
8892
::testing::Values("script/Latin") );
89-
INSTANTIATE_TEST_CASE_P( Deva, MatchGroundTruth,
93+
INSTANTIATE_TEST_CASE_P( DISABLED_Deva, MatchGroundTruth,
9094
::testing::Values("script/Devanagari") );
91-
INSTANTIATE_TEST_CASE_P( Arab, MatchGroundTruth,
95+
INSTANTIATE_TEST_CASE_P( DISABLED_Arabic, MatchGroundTruth,
9296
::testing::Values("script/Arabic") );
9397

9498
class EuroText : public QuickTest {
@@ -101,7 +105,7 @@ class QuickTest : public testing::Test {
101105
}
102106

103107
// script/Latin for eurotext.tif does not match groundtruth
104-
// for tessdata & tessdata_best
108+
// for tessdata & tessdata_best.
105109
// so do not test these here.
106110

107111
} // namespace

unittest/loadlang_test.cc

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
///////////////////////////////////////////////////////////////////////
22
// File: loadlang_test.cc
33
// Description: Test loading of All languages and Scripts for Tesseract.
4+
// Tests for All languages and scripts are Disabled by default.
5+
// Force the disabled test to run if required by using the --gtest_also_run_disabled_tests argument.
46
// Author: Shree Devi Kumar
57
//
68
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -169,11 +171,11 @@ class QuickTest : public testing::Test {
169171
TEST_P(LoadLanguage, yid) {LangLoader("yid" , GetParam());}
170172
TEST_P(LoadLanguage, yor) {LangLoader("yor" , GetParam());}
171173

172-
INSTANTIATE_TEST_CASE_P( Tessdata_fast, LoadLanguage,
174+
INSTANTIATE_TEST_CASE_P( DISABLED_Tessdata_fast, LoadLanguage,
173175
::testing::Values(TESSDATA_DIR "_fast") );
174-
INSTANTIATE_TEST_CASE_P( Tessdata_best, LoadLanguage,
176+
INSTANTIATE_TEST_CASE_P( DISABLED_Tessdata_best, LoadLanguage,
175177
::testing::Values(TESSDATA_DIR "_best") );
176-
INSTANTIATE_TEST_CASE_P( Tessdata, LoadLanguage,
178+
INSTANTIATE_TEST_CASE_P( DISABLED_Tessdata, LoadLanguage,
177179
::testing::Values(TESSDATA_DIR) );
178180

179181
// For all scripts
@@ -220,18 +222,22 @@ class QuickTest : public testing::Test {
220222
TEST_P(LoadScript, Tibetan) {LangLoader("script/Tibetan" , GetParam());}
221223
TEST_P(LoadScript, Vietnamese) {LangLoader("script/Vietnamese" , GetParam());}
222224

223-
INSTANTIATE_TEST_CASE_P( Tessdata_fast, LoadScript,
225+
INSTANTIATE_TEST_CASE_P( DISABLED_Tessdata_fast, LoadScript,
224226
::testing::Values(TESSDATA_DIR "_fast") );
225-
INSTANTIATE_TEST_CASE_P( Tessdata_best, LoadScript,
227+
INSTANTIATE_TEST_CASE_P( DISABLED_Tessdata_best, LoadScript,
226228
::testing::Values(TESSDATA_DIR "_best") );
227-
INSTANTIATE_TEST_CASE_P( Tessdata, LoadScript,
229+
INSTANTIATE_TEST_CASE_P( DISABLED_Tessdata, LoadScript,
228230
::testing::Values(TESSDATA_DIR) );
229231

230-
// Use class LoadLang for languages which are NOT there in all three repos
231-
232232
class LoadLang : public QuickTest {
233233
};
234234

235+
// Test Load of English here, as the parameterized tests are disabled by default.
236+
TEST_F(LoadLang, engFast) {LangLoader("eng" , TESSDATA_DIR "_fast");}
237+
TEST_F(LoadLang, engBest) {LangLoader("eng" , TESSDATA_DIR "_best");}
238+
TEST_F(LoadLang, engBestInt) {LangLoader("eng" , TESSDATA_DIR);}
239+
240+
// Use class LoadLang for languages which are NOT there in all three repos
235241
TEST_F(LoadLang, kmrFast) {LangLoader("kmr" , TESSDATA_DIR "_fast");}
236242
TEST_F(LoadLang, kmrBest) {LangLoader("kmr" , TESSDATA_DIR "_best");}
237243
// TEST_F(LoadLang, kmrBestInt) {LangLoader("kmr" , TESSDATA_DIR);}

0 commit comments

Comments
 (0)