]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: add missing header cmath to test/mon/test_mon_memory_target.cc 32815/head
authorSu Yue <Damenly_Su@gmx.com>
Tue, 10 Sep 2019 07:30:57 +0000 (15:30 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 24 Jan 2020 02:18:02 +0000 (10:18 +0800)
While building ceph, the complier complains:
=================================================================
[ 86%] Building CXX object src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/test_mon_memory_target.cc.o
/root/ceph/src/test/mon/test_mon_memory_target.cc: In int main(int, :
/root/ceph/src/test/mon/test_mon_memory_target.cc:66:16:  was not declared in this scope
   66 |   auto stdev = sqrt(sump / results.size());
      |                ^~~~
make[2]: *** [src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/build.make:63: src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/test_mon_memory_target.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:15575: src/test/mon/CMakeFiles/ceph_test_mon_memory_target.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
=================================================================

This's caused by lack of header cmath which is required by
std::sqrt().
Fix it by add the header then build continues.

Fixes: https://tracker.ceph.com/issues/41739
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
(cherry picked from commit 9acfb351a3965c28d390822fd8f2ec5675b29064)

src/test/mon/test_mon_memory_target.cc

index da3a86d6517d5f50303fb80eb8d009c8f7adcd11..e8f975b47bb1315e048e2daa78a997e7f1810b27 100644 (file)
@@ -1,4 +1,5 @@
 #include <algorithm>
+#include <cmath>
 #include <iostream>
 #include <string>
 #include <numeric>