Bug #73407 -DMAX_INDEXES != 64 causes build failure in opt_range-t unit test
Submitted: 27 Jul 2014 15:38 Modified: 19 Aug 2014 15:01
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7.4 OS:Any
Assigned to: Tor Didriksen CPU Architecture:Any
Tags: build, max_indexes, unittest

[27 Jul 2014 15:38] Laurynas Biveinis
Description:
Unit test opt_range-t expects hardcoded 64 max indexes.

cmake .. -DMAX_INDEXES=255
...
make
...
Scanning dependencies of target merge_large_tests-t
[ 82%] Building CXX object unittest/gunit/CMakeFiles/merge_large_tests-t.dir/merge_large_tests.cc.o
In file included from /Users/laurynas/percona/lp-mysql-server/mysql-server/obj-max-indexes-255/unittest/gunit/merge_large_tests.cc:2:
In file included from /Users/laurynas/percona/lp-mysql-server/mysql-server/unittest/gunit/copy_info-t.cc:19:
/Users/laurynas/percona/lp-mysql-server/mysql-server/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest.h:1316:16: error: invalid operands to binary expression
      ('const Bitmap<64>' and 'const Bitmap<256>')
  if (expected == actual) {
      ~~~~~~~~ ^  ~~~~~~
/Users/laurynas/percona/lp-mysql-server/mysql-server/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest.h:1352:12: note: in instantiation of function template specialization
      'testing::internal::CmpHelperEQ<Bitmap<64>, Bitmap<256> >' requested here
    return CmpHelperEQ(expected_expression, actual_expression, expected,
           ^
/Users/laurynas/percona/lp-mysql-server/mysql-server/unittest/gunit/opt_range-t.cc:1893:3: note: in instantiation of function template specialization
      'testing::internal::EqHelper<false>::Compare<Bitmap<64>, Bitmap<256> >' requested here
  EXPECT_EQ(Bitmap<64>(1), sel_tree->keys_map);
  ^
/Users/laurynas/percona/lp-mysql-server/mysql-server/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest.h:1848:67: note: expanded from macro 'EXPECT_EQ'
                      EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
                                                                  ^
/Users/laurynas/percona/lp-mysql-server/mysql-server/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest_pred_impl.h:162:23: note: expanded from macro 'EXPECT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
                      ^
/Users/laurynas/percona/lp-mysql-server/mysql-server/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest_pred_impl.h:147:17: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
                ^
/Users/laurynas/percona/lp-mysql-server/mysql-server/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^
/Users/laurynas/percona/lp-mysql-server/mysql-server/sql/sql_bitmap.h:155:11: note: candidate function not viable: no known conversion from 'const Bitmap<256>' to 'const Bitmap<64>' for 1st argument
  my_bool operator==(const Bitmap<64>& map2) const { return map == map2.map; }
          ^
/Users/laurynas/percona/lp-mysql-server/mysql-server/source_downloads/gmock-1.6.0/gtest/include/gtest/internal/gtest-linked_ptr.h:213:6: note: candidate template ignored: could not match 'T *' against
      'Bitmap<64>'
bool operator==(T* ptr, const linked_ptr<T>& x) {
     ^
1 error generated.
make[2]: *** [unittest/gunit/CMakeFiles/merge_large_tests-t.dir/merge_large_tests.cc.o] Error 1
make[1]: *** [unittest/gunit/CMakeFiles/merge_large_tests-t.dir/all] Error 2
make: *** [all] Error 2

How to repeat:
See above.

Suggested fix:
Replace the hardcoded value with whatever cmake gives for MAX_INDEXES
[28 Jul 2014 8:28] MySQL Verification Team
Hello Laurynas,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[28 Jul 2014 8:30] MySQL Verification Team
// How to repeat

[ushastry@ushastry 574]$ cmake28 .. -DMAX_INDEXES=255 -DCMAKE_INSTALL_PREFIX=/home/ushastry/mybuilds/mysql-5.7.4/ -DENABLE_DOWNLOADS=YES
..
..

[ushastry@ushastry 574]$ sudo make
..

Scanning dependencies of target merge_large_tests-t
[ 80%] Building CXX object unittest/gunit/CMakeFiles/merge_large_tests-t.dir/merge_large_tests.cc.o
In file included from /home/ushastry/mybuilds/mysql-5.7.4/unittest/gunit/copy_info-t.cc:19,
                 from /home/ushastry/mybuilds/mysql-5.7.4/574/unittest/gunit/merge_large_tests.cc:2:
/home/ushastry/mybuilds/mysql-5.7.4/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest.h: In function ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = Bitmap<64u>, T2 = Bitmap<256u>]’:
/home/ushastry/mybuilds/mysql-5.7.4/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest.h:1353:   instantiated from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = Bitmap<64u>, T2 = key_map, bool lhs_is_null_literal = false]’
/home/ushastry/mybuilds/mysql-5.7.4/unittest/gunit/opt_range-t.cc:1893:   instantiated from here
/home/ushastry/mybuilds/mysql-5.7.4/source_downloads/gmock-1.6.0/gtest/include/gtest/gtest.h:1316: error: no match for ‘operator==’ in ‘expected == actual’
/home/ushastry/mybuilds/mysql-5.7.4/sql/sql_bitmap.h:155: note: candidates are: my_bool Bitmap<64u>::operator==(const Bitmap<64u>&) const
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-compare-distinct-pointer-types"
cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedefs"
cc1plus: warning: unrecognized command line option "-Wno-null-dereference"
make[2]: *** [unittest/gunit/CMakeFiles/merge_large_tests-t.dir/merge_large_tests.cc.o] Error 1
make[1]: *** [unittest/gunit/CMakeFiles/merge_large_tests-t.dir/all] Error 2
make: *** [all] Error 2
[28 Jul 2014 8:31] MySQL Verification Team
// If you are behind proxy then manually download gmock and put it in source_downloads of 5.7.4 source..

[ushastry@ushastry mysql-5.7.4]$ cd source_downloads/
[ushastry@ushastry source_downloads]$ export http_proxy=www-proxy.us.oracle.com:80
[ushastry@ushastry source_downloads]$ wget http://googlemock.googlecode.com/files/gmock-1.6.0.zip
--2014-07-28 13:52:01--  http://googlemock.googlecode.com/files/gmock-1.6.0.zip
Resolving www-proxy.us.oracle.com... 148.87.19.20
Connecting to www-proxy.us.oracle.com|148.87.19.20|:80... connected.
Proxy request sent, awaiting response... 200 OK
Length: 2053682 (2.0M) [application/x-zip]
Saving to: “gmock-1.6.0.zip”

100%[===========================================================================================================================================================>] 2,053,682    104K/s   in 38s     

2014-07-28 13:52:45 (52.4 KB/s) - “gmock-1.6.0.zip” saved [2053682/2053682]

[ushastry@ushastry source_downloads]$ cd ..
[ushastry@ushastry mysql-5.7.4]$ pwd
/home/ushastry/mybuilds/mysql-5.7.4
[ushastry@ushastry mysql-5.7.4]$ mkdir -p 574
[ushastry@ushastry mysql-5.7.4]$ mkdir -p 574 && cd 574
[ushastry@ushastry 574]$
[19 Aug 2014 15:01] Paul DuBois
Fixed in 5.7.5.

Changes for test suite. No changelog entry needed.