rocksdb-lego-determinator 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  1. #!/usr/bin/env bash
  2. # This script is executed by Sandcastle
  3. # to determine next steps to run
  4. # Usage:
  5. # EMAIL=<email> ONCALL=<email> TRIGGER=<trigger> SUBSCRIBER=<email> rocks_ci.py <test-name>
  6. #
  7. # Input Value
  8. # -------------------------------------------------------------------------
  9. # EMAIL Email address to report on trigger conditions
  10. # ONCALL Email address to raise a task on failure
  11. # TRIGGER Trigger conditions for email. Valid values are fail, warn, all
  12. # SUBSCRIBER Email addresss to add as subscriber for task
  13. #
  14. #
  15. # Report configuration
  16. #
  17. REPORT_EMAIL=
  18. if [ ! -z $EMAIL ]; then
  19. if [ -z $TRIGGER ]; then
  20. TRIGGER="fail"
  21. fi
  22. REPORT_EMAIL="
  23. {
  24. 'type':'email',
  25. 'triggers': [ '$TRIGGER' ],
  26. 'emails':['$EMAIL']
  27. },"
  28. fi
  29. CREATE_TASK=
  30. if [ ! -z $ONCALL ]; then
  31. CREATE_TASK="
  32. {
  33. 'type':'task',
  34. 'triggers':[ 'fail' ],
  35. 'priority':0,
  36. 'subscribers':[ '$SUBSCRIBER' ],
  37. 'tags':[ 'rocksdb', 'ci' ],
  38. },"
  39. fi
  40. # For now, create the tasks using only the dedicated task creation tool.
  41. CREATE_TASK=
  42. REPORT=
  43. if [[ ! -z $REPORT_EMAIL || ! -z $CREATE_TASK ]]; then
  44. REPORT="'report': [
  45. $REPORT_EMAIL
  46. $CREATE_TASK
  47. ]"
  48. fi
  49. #
  50. # Helper variables
  51. #
  52. CLEANUP_ENV="
  53. {
  54. 'name':'Cleanup environment',
  55. 'shell':'rm -rf /dev/shm/rocksdb && mkdir /dev/shm/rocksdb && (chmod +t /dev/shm || true) && make clean',
  56. 'user':'root'
  57. }"
  58. UPLOAD_DB_DIR="
  59. {
  60. 'name':'Upload database directory',
  61. 'shell':'tar -cvzf rocksdb_db.tar.gz /dev/shm/rocksdb/',
  62. 'user':'root',
  63. 'cleanup':true,
  64. 'provide_artifacts': [
  65. {
  66. 'name':'rocksdb_db_dir',
  67. 'paths': ['rocksdb_db.tar.gz'],
  68. 'bundle': false,
  69. },
  70. ],
  71. }"
  72. # We will eventually set the RATIO to 1, but we want do this
  73. # in steps. RATIO=$(nproc) will make it work as J=1
  74. if [ -z $RATIO ]; then
  75. RATIO=$(nproc)
  76. fi
  77. if [ -z $PARALLEL_J ]; then
  78. PARALLEL_J="J=$(expr $(nproc) / ${RATIO})"
  79. fi
  80. if [ -z $PARALLEL_j ]; then
  81. PARALLEL_j="-j$(expr $(nproc) / ${RATIO})"
  82. fi
  83. PARALLELISM="$PARALLEL_J $PARALLEL_j"
  84. DEBUG="OPT=-g"
  85. SHM="TEST_TMPDIR=/dev/shm/rocksdb"
  86. NON_SHM="TMPD=/tmp/rocksdb_test_tmp"
  87. GCC_481="ROCKSDB_FBCODE_BUILD_WITH_481=1"
  88. ASAN="COMPILE_WITH_ASAN=1"
  89. CLANG="USE_CLANG=1"
  90. # in gcc-5 there are known problems with TSAN like https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71090.
  91. # using platform007 gives us gcc-8 or higher which has that bug fixed.
  92. TSAN="ROCKSDB_FBCODE_BUILD_WITH_PLATFORM007=1 COMPILE_WITH_TSAN=1"
  93. UBSAN="COMPILE_WITH_UBSAN=1"
  94. TSAN_CRASH='CRASH_TEST_EXT_ARGS="--compression_type=zstd --log2_keys_per_lock=22"'
  95. NON_TSAN_CRASH="CRASH_TEST_EXT_ARGS=--compression_type=zstd"
  96. DISABLE_JEMALLOC="DISABLE_JEMALLOC=1"
  97. HTTP_PROXY="https_proxy=http://fwdproxy.29.prn1:8080 http_proxy=http://fwdproxy.29.prn1:8080 ftp_proxy=http://fwdproxy.29.prn1:8080"
  98. SETUP_JAVA_ENV="export $HTTP_PROXY; export JAVA_HOME=/usr/local/jdk-8u60-64/; export PATH=\$JAVA_HOME/bin:\$PATH"
  99. PARSER="'parser':'python build_tools/error_filter.py $1'"
  100. CONTRUN_NAME="ROCKSDB_CONTRUN_NAME"
  101. # This code is getting called under various scenarios. What we care about is to
  102. # understand when it's called from nightly contruns because in that case we'll
  103. # create tasks for any failures. To follow the existing pattern, we'll check
  104. # the value of $ONCALL. If it's a diff then just call `false` to make sure
  105. # that errors will be properly propagated to the caller.
  106. if [ ! -z $ONCALL ]; then
  107. TASK_CREATION_TOOL="/usr/local/bin/mysql_mtr_filter --rocksdb --oncall $ONCALL"
  108. else
  109. TASK_CREATION_TOOL="false"
  110. fi
  111. #
  112. # A mechanism to disable tests temporarily
  113. #
  114. DISABLE_COMMANDS="[
  115. {
  116. 'name':'Disable test',
  117. 'oncall':'$ONCALL',
  118. 'steps': [
  119. {
  120. 'name':'Job disabled. Please contact test owner',
  121. 'shell':'exit 1',
  122. 'user':'root'
  123. },
  124. ],
  125. }
  126. ]"
  127. #
  128. # RocksDB unit test
  129. #
  130. UNIT_TEST_COMMANDS="[
  131. {
  132. 'name':'Rocksdb Unit Test',
  133. 'oncall':'$ONCALL',
  134. 'executeLocal': 'true',
  135. 'steps': [
  136. $CLEANUP_ENV,
  137. {
  138. 'name':'Build and test RocksDB debug version',
  139. 'shell':'$SHM $DEBUG make $PARALLELISM check || $CONTRUN_NAME=check $TASK_CREATION_TOOL',
  140. 'user':'root',
  141. $PARSER
  142. },
  143. ],
  144. $REPORT
  145. }
  146. ]"
  147. #
  148. # RocksDB unit test not under /dev/shm
  149. #
  150. UNIT_TEST_NON_SHM_COMMANDS="[
  151. {
  152. 'name':'Rocksdb Unit Test',
  153. 'oncall':'$ONCALL',
  154. 'executeLocal': 'true',
  155. 'timeout': 86400,
  156. 'steps': [
  157. $CLEANUP_ENV,
  158. {
  159. 'name':'Build and test RocksDB debug version',
  160. 'timeout': 86400,
  161. 'shell':'$NON_SHM $DEBUG make $PARALLELISM check || $CONTRUN_NAME=non_shm_check $TASK_CREATION_TOOL',
  162. 'user':'root',
  163. $PARSER
  164. },
  165. ],
  166. $REPORT
  167. }
  168. ]"
  169. #
  170. # RocksDB release build and unit tests
  171. #
  172. RELEASE_BUILD_COMMANDS="[
  173. {
  174. 'name':'Rocksdb Release Build',
  175. 'oncall':'$ONCALL',
  176. 'executeLocal': 'true',
  177. 'steps': [
  178. $CLEANUP_ENV,
  179. {
  180. 'name':'Build RocksDB release',
  181. 'shell':'make $PARALLEL_j release || $CONTRUN_NAME=release $TASK_CREATION_TOOL',
  182. 'user':'root',
  183. $PARSER
  184. },
  185. ],
  186. $REPORT
  187. }
  188. ]"
  189. #
  190. # RocksDB unit test on gcc-4.8.1
  191. #
  192. UNIT_TEST_COMMANDS_481="[
  193. {
  194. 'name':'Rocksdb Unit Test on GCC 4.8.1',
  195. 'oncall':'$ONCALL',
  196. 'executeLocal': 'true',
  197. 'steps': [
  198. $CLEANUP_ENV,
  199. {
  200. 'name':'Build and test RocksDB debug version',
  201. 'shell':'$SHM $GCC_481 $DEBUG make $PARALLELISM check || $CONTRUN_NAME=unit_gcc_481_check $TASK_CREATION_TOOL',
  202. 'user':'root',
  203. $PARSER
  204. },
  205. ],
  206. $REPORT
  207. }
  208. ]"
  209. #
  210. # RocksDB release build and unit tests
  211. #
  212. RELEASE_BUILD_COMMANDS_481="[
  213. {
  214. 'name':'Rocksdb Release on GCC 4.8.1',
  215. 'oncall':'$ONCALL',
  216. 'executeLocal': 'true',
  217. 'steps': [
  218. $CLEANUP_ENV,
  219. {
  220. 'name':'Build RocksDB release on GCC 4.8.1',
  221. 'shell':'$GCC_481 make $PARALLEL_j release || $CONTRUN_NAME=release_gcc481 $TASK_CREATION_TOOL',
  222. 'user':'root',
  223. $PARSER
  224. },
  225. ],
  226. $REPORT
  227. }
  228. ]"
  229. #
  230. # RocksDB unit test with CLANG
  231. #
  232. CLANG_UNIT_TEST_COMMANDS="[
  233. {
  234. 'name':'Rocksdb Unit Test',
  235. 'oncall':'$ONCALL',
  236. 'executeLocal': 'true',
  237. 'steps': [
  238. $CLEANUP_ENV,
  239. {
  240. 'name':'Build and test RocksDB debug',
  241. 'shell':'$CLANG $SHM $DEBUG make $PARALLELISM check || $CONTRUN_NAME=clang_check $TASK_CREATION_TOOL',
  242. 'user':'root',
  243. $PARSER
  244. },
  245. ],
  246. $REPORT
  247. }
  248. ]"
  249. #
  250. # RocksDB release build with CLANG
  251. #
  252. CLANG_RELEASE_BUILD_COMMANDS="[
  253. {
  254. 'name':'Rocksdb CLANG Release Build',
  255. 'oncall':'$ONCALL',
  256. 'executeLocal': 'true',
  257. 'steps': [
  258. $CLEANUP_ENV,
  259. {
  260. 'name':'Build RocksDB release',
  261. 'shell':'$CLANG make $PARALLEL_j release|| $CONTRUN_NAME=clang_release $TASK_CREATION_TOOL',
  262. 'user':'root',
  263. $PARSER
  264. },
  265. ],
  266. $REPORT
  267. }
  268. ]"
  269. #
  270. # RocksDB analyze
  271. #
  272. CLANG_ANALYZE_COMMANDS="[
  273. {
  274. 'name':'Rocksdb analyze',
  275. 'oncall':'$ONCALL',
  276. 'executeLocal': 'true',
  277. 'steps': [
  278. $CLEANUP_ENV,
  279. {
  280. 'name':'RocksDB build and analyze',
  281. 'shell':'$CLANG $SHM $DEBUG make $PARALLEL_j analyze || $CONTRUN_NAME=clang_analyze $TASK_CREATION_TOOL',
  282. 'user':'root',
  283. $PARSER
  284. },
  285. ],
  286. $REPORT
  287. }
  288. ]"
  289. #
  290. # RocksDB code coverage
  291. #
  292. CODE_COV_COMMANDS="[
  293. {
  294. 'name':'Rocksdb Unit Test Code Coverage',
  295. 'oncall':'$ONCALL',
  296. 'executeLocal': 'true',
  297. 'steps': [
  298. $CLEANUP_ENV,
  299. {
  300. 'name':'Build, test and collect code coverage info',
  301. 'shell':'$SHM $DEBUG make $PARALLELISM coverage || $CONTRUN_NAME=coverage $TASK_CREATION_TOOL',
  302. 'user':'root',
  303. $PARSER
  304. },
  305. ],
  306. $REPORT
  307. }
  308. ]"
  309. #
  310. # RocksDB unity
  311. #
  312. UNITY_COMMANDS="[
  313. {
  314. 'name':'Rocksdb Unity',
  315. 'oncall':'$ONCALL',
  316. 'executeLocal': 'true',
  317. 'steps': [
  318. $CLEANUP_ENV,
  319. {
  320. 'name':'Build, test unity test',
  321. 'shell':'$SHM $DEBUG V=1 make J=1 unity_test || $CONTRUN_NAME=unity_test $TASK_CREATION_TOOL',
  322. 'user':'root',
  323. $PARSER
  324. },
  325. ],
  326. $REPORT
  327. }
  328. ]"
  329. #
  330. # Build RocksDB lite
  331. #
  332. LITE_BUILD_COMMANDS="[
  333. {
  334. 'name':'Rocksdb Lite build',
  335. 'oncall':'$ONCALL',
  336. 'executeLocal': 'true',
  337. 'steps': [
  338. $CLEANUP_ENV,
  339. {
  340. 'name':'Build RocksDB debug version',
  341. 'shell':'make J=1 LITE=1 all check || $CONTRUN_NAME=lite $TASK_CREATION_TOOL',
  342. 'user':'root',
  343. $PARSER
  344. },
  345. ],
  346. $REPORT
  347. }
  348. ]"
  349. #
  350. # Report RocksDB lite binary size to scuba
  351. REPORT_LITE_BINARY_SIZE_COMMANDS="[
  352. {
  353. 'name':'Rocksdb Lite Binary Size',
  354. 'oncall':'$ONCALL',
  355. 'executeLocal': 'true',
  356. 'steps': [
  357. $CLEANUP_ENV,
  358. {
  359. 'name':'Report RocksDB Lite binary size to scuba',
  360. 'shell':'tools/report_lite_binary_size.sh',
  361. 'user':'root',
  362. },
  363. ],
  364. ]"
  365. #
  366. # RocksDB stress/crash test
  367. #
  368. STRESS_CRASH_TEST_COMMANDS="[
  369. {
  370. 'name':'Rocksdb Stress and Crash Test',
  371. 'oncall':'$ONCALL',
  372. 'executeLocal': 'true',
  373. 'timeout': 86400,
  374. 'steps': [
  375. $CLEANUP_ENV,
  376. {
  377. 'name':'Build and run RocksDB debug stress tests',
  378. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 db_stress || $CONTRUN_NAME=db_stress $TASK_CREATION_TOOL',
  379. 'user':'root',
  380. $PARSER
  381. },
  382. {
  383. 'name':'Build and run RocksDB debug crash tests',
  384. 'timeout': 86400,
  385. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 crash_test || $CONTRUN_NAME=crash_test $TASK_CREATION_TOOL',
  386. 'user':'root',
  387. $PARSER
  388. },
  389. $UPLOAD_DB_DIR,
  390. ],
  391. $REPORT
  392. }
  393. ]"
  394. #
  395. # RocksDB stress/crash test with atomic flush
  396. #
  397. STRESS_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS="[
  398. {
  399. 'name':'Rocksdb Stress and Crash Test with atomic flush',
  400. 'oncall':'$ONCALL',
  401. 'executeLocal': 'true',
  402. 'timeout': 86400,
  403. 'steps': [
  404. $CLEANUP_ENV,
  405. {
  406. 'name':'Build and run RocksDB debug stress tests',
  407. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 db_stress || $CONTRUN_NAME=db_stress $TASK_CREATION_TOOL',
  408. 'user':'root',
  409. $PARSER
  410. },
  411. {
  412. 'name':'Build and run RocksDB debug crash tests with atomic flush',
  413. 'timeout': 86400,
  414. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 crash_test_with_atomic_flush || $CONTRUN_NAME=crash_test_with_atomic_flush $TASK_CREATION_TOOL',
  415. 'user':'root',
  416. $PARSER
  417. },
  418. $UPLOAD_DB_DIR,
  419. ],
  420. $REPORT
  421. }
  422. ]"
  423. #
  424. # RocksDB stress/crash test with txn
  425. #
  426. STRESS_CRASH_TEST_WITH_TXN_COMMANDS="[
  427. {
  428. 'name':'Rocksdb Stress and Crash Test with txn',
  429. 'oncall':'$ONCALL',
  430. 'executeLocal': 'true',
  431. 'timeout': 86400,
  432. 'steps': [
  433. $CLEANUP_ENV,
  434. {
  435. 'name':'Build and run RocksDB debug stress tests',
  436. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 db_stress || $CONTRUN_NAME=db_stress $TASK_CREATION_TOOL',
  437. 'user':'root',
  438. $PARSER
  439. },
  440. {
  441. 'name':'Build and run RocksDB debug crash tests with txn',
  442. 'timeout': 86400,
  443. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 crash_test_with_txn || $CONTRUN_NAME=crash_test_with_txn $TASK_CREATION_TOOL',
  444. 'user':'root',
  445. $PARSER
  446. },
  447. $UPLOAD_DB_DIR,
  448. ],
  449. $REPORT
  450. }
  451. ]"
  452. # RocksDB write stress test.
  453. # We run on disk device on purpose (i.e. no $SHM)
  454. # because we want to add some randomness to fsync commands
  455. WRITE_STRESS_COMMANDS="[
  456. {
  457. 'name':'Rocksdb Write Stress Test',
  458. 'oncall':'$ONCALL',
  459. 'executeLocal': 'true',
  460. 'steps': [
  461. $CLEANUP_ENV,
  462. {
  463. 'name':'Build and run RocksDB write stress tests',
  464. 'shell':'make write_stress && python tools/write_stress_runner.py --runtime_sec=3600 --db=/tmp/rocksdb_write_stress || $CONTRUN_NAME=write_stress $TASK_CREATION_TOOL',
  465. 'user':'root',
  466. $PARSER
  467. }
  468. ],
  469. 'artifacts': [{'name': 'database', 'paths': ['/tmp/rocksdb_write_stress']}],
  470. $REPORT
  471. }
  472. ]"
  473. #
  474. # RocksDB test under address sanitizer
  475. #
  476. ASAN_TEST_COMMANDS="[
  477. {
  478. 'name':'Rocksdb Unit Test under ASAN',
  479. 'oncall':'$ONCALL',
  480. 'executeLocal': 'true',
  481. 'steps': [
  482. $CLEANUP_ENV,
  483. {
  484. 'name':'Test RocksDB debug under ASAN',
  485. 'shell':'set -o pipefail && ($SHM $ASAN $DEBUG make $PARALLELISM asan_check || $CONTRUN_NAME=asan_check $TASK_CREATION_TOOL) |& /usr/facebook/ops/scripts/asan_symbolize.py -d',
  486. 'user':'root',
  487. $PARSER
  488. }
  489. ],
  490. $REPORT
  491. }
  492. ]"
  493. #
  494. # RocksDB crash testing under address sanitizer
  495. #
  496. ASAN_CRASH_TEST_COMMANDS="[
  497. {
  498. 'name':'Rocksdb crash test under ASAN',
  499. 'oncall':'$ONCALL',
  500. 'executeLocal': 'true',
  501. 'timeout': 86400,
  502. 'steps': [
  503. $CLEANUP_ENV,
  504. {
  505. 'name':'Build and run RocksDB debug asan_crash_test',
  506. 'timeout': 86400,
  507. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 asan_crash_test || $CONTRUN_NAME=asan_crash_test $TASK_CREATION_TOOL',
  508. 'user':'root',
  509. $PARSER
  510. },
  511. $UPLOAD_DB_DIR,
  512. ],
  513. $REPORT
  514. }
  515. ]"
  516. #
  517. # RocksDB crash testing with atomic flush under address sanitizer
  518. #
  519. ASAN_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS="[
  520. {
  521. 'name':'Rocksdb crash test with atomic flush under ASAN',
  522. 'oncall':'$ONCALL',
  523. 'executeLocal': 'true',
  524. 'timeout': 86400,
  525. 'steps': [
  526. $CLEANUP_ENV,
  527. {
  528. 'name':'Build and run RocksDB debug asan_crash_test_with_atomic_flush',
  529. 'timeout': 86400,
  530. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 asan_crash_test_with_atomic_flush || $CONTRUN_NAME=asan_crash_test_with_atomic_flush $TASK_CREATION_TOOL',
  531. 'user':'root',
  532. $PARSER
  533. },
  534. $UPLOAD_DB_DIR,
  535. ],
  536. $REPORT
  537. }
  538. ]"
  539. #
  540. # RocksDB crash testing with txn under address sanitizer
  541. #
  542. ASAN_CRASH_TEST_WITH_TXN_COMMANDS="[
  543. {
  544. 'name':'Rocksdb crash test with txn under ASAN',
  545. 'oncall':'$ONCALL',
  546. 'executeLocal': 'true',
  547. 'timeout': 86400,
  548. 'steps': [
  549. $CLEANUP_ENV,
  550. {
  551. 'name':'Build and run RocksDB debug asan_crash_test_with_txn',
  552. 'timeout': 86400,
  553. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH make J=1 asan_crash_test_with_txn || $CONTRUN_NAME=asan_crash_test_with_txn $TASK_CREATION_TOOL',
  554. 'user':'root',
  555. $PARSER
  556. },
  557. $UPLOAD_DB_DIR,
  558. ],
  559. $REPORT
  560. }
  561. ]"
  562. #
  563. # RocksDB test under undefined behavior sanitizer
  564. #
  565. UBSAN_TEST_COMMANDS="[
  566. {
  567. 'name':'Rocksdb Unit Test under UBSAN',
  568. 'oncall':'$ONCALL',
  569. 'executeLocal': 'true',
  570. 'steps': [
  571. $CLEANUP_ENV,
  572. {
  573. 'name':'Test RocksDB debug under UBSAN',
  574. 'shell':'set -o pipefail && $SHM $UBSAN $CLANG $DEBUG make $PARALLELISM ubsan_check || $CONTRUN_NAME=ubsan_check $TASK_CREATION_TOOL',
  575. 'user':'root',
  576. $PARSER
  577. }
  578. ],
  579. $REPORT
  580. }
  581. ]"
  582. #
  583. # RocksDB crash testing under udnefined behavior sanitizer
  584. #
  585. UBSAN_CRASH_TEST_COMMANDS="[
  586. {
  587. 'name':'Rocksdb crash test under UBSAN',
  588. 'oncall':'$ONCALL',
  589. 'executeLocal': 'true',
  590. 'timeout': 86400,
  591. 'steps': [
  592. $CLEANUP_ENV,
  593. {
  594. 'name':'Build and run RocksDB debug ubsan_crash_test',
  595. 'timeout': 86400,
  596. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH $CLANG make J=1 ubsan_crash_test || $CONTRUN_NAME=ubsan_crash_test $TASK_CREATION_TOOL',
  597. 'user':'root',
  598. $PARSER
  599. },
  600. $UPLOAD_DB_DIR,
  601. ],
  602. $REPORT
  603. }
  604. ]"
  605. #
  606. # RocksDB crash testing with atomic flush under undefined behavior sanitizer
  607. #
  608. UBSAN_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS="[
  609. {
  610. 'name':'Rocksdb crash test with atomic flush under UBSAN',
  611. 'oncall':'$ONCALL',
  612. 'executeLocal': 'true',
  613. 'timeout': 86400,
  614. 'steps': [
  615. $CLEANUP_ENV,
  616. {
  617. 'name':'Build and run RocksDB debug ubsan_crash_test_with_atomic_flush',
  618. 'timeout': 86400,
  619. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH $CLANG make J=1 ubsan_crash_test_with_atomic_flush || $CONTRUN_NAME=ubsan_crash_test_with_atomic_flush $TASK_CREATION_TOOL',
  620. 'user':'root',
  621. $PARSER
  622. },
  623. $UPLOAD_DB_DIR,
  624. ],
  625. $REPORT
  626. }
  627. ]"
  628. #
  629. # RocksDB crash testing with txn under undefined behavior sanitizer
  630. #
  631. UBSAN_CRASH_TEST_WITH_TXN_COMMANDS="[
  632. {
  633. 'name':'Rocksdb crash test with txn under UBSAN',
  634. 'oncall':'$ONCALL',
  635. 'executeLocal': 'true',
  636. 'timeout': 86400,
  637. 'steps': [
  638. $CLEANUP_ENV,
  639. {
  640. 'name':'Build and run RocksDB debug ubsan_crash_test_with_txn',
  641. 'timeout': 86400,
  642. 'shell':'$SHM $DEBUG $NON_TSAN_CRASH $CLANG make J=1 ubsan_crash_test_with_txn || $CONTRUN_NAME=ubsan_crash_test_with_txn $TASK_CREATION_TOOL',
  643. 'user':'root',
  644. $PARSER
  645. },
  646. $UPLOAD_DB_DIR,
  647. ],
  648. $REPORT
  649. }
  650. ]"
  651. #
  652. # RocksDB unit test under valgrind
  653. #
  654. VALGRIND_TEST_COMMANDS="[
  655. {
  656. 'name':'Rocksdb Unit Test under valgrind',
  657. 'oncall':'$ONCALL',
  658. 'executeLocal': 'true',
  659. 'timeout': 86400,
  660. 'steps': [
  661. $CLEANUP_ENV,
  662. {
  663. 'name':'Run RocksDB debug unit tests',
  664. 'timeout': 86400,
  665. 'shell':'$SHM $DEBUG make $PARALLELISM valgrind_test || $CONTRUN_NAME=valgrind_check $TASK_CREATION_TOOL',
  666. 'user':'root',
  667. $PARSER
  668. },
  669. ],
  670. $REPORT
  671. }
  672. ]"
  673. #
  674. # RocksDB test under TSAN
  675. #
  676. TSAN_UNIT_TEST_COMMANDS="[
  677. {
  678. 'name':'Rocksdb Unit Test under TSAN',
  679. 'oncall':'$ONCALL',
  680. 'executeLocal': 'true',
  681. 'timeout': 86400,
  682. 'steps': [
  683. $CLEANUP_ENV,
  684. {
  685. 'name':'Run RocksDB debug unit test',
  686. 'timeout': 86400,
  687. 'shell':'set -o pipefail && $SHM $DEBUG $TSAN make $PARALLELISM check || $CONTRUN_NAME=tsan_check $TASK_CREATION_TOOL',
  688. 'user':'root',
  689. $PARSER
  690. },
  691. ],
  692. $REPORT
  693. }
  694. ]"
  695. #
  696. # RocksDB crash test under TSAN
  697. #
  698. TSAN_CRASH_TEST_COMMANDS="[
  699. {
  700. 'name':'Rocksdb Crash Test under TSAN',
  701. 'oncall':'$ONCALL',
  702. 'executeLocal': 'true',
  703. 'timeout': 86400,
  704. 'steps': [
  705. $CLEANUP_ENV,
  706. {
  707. 'name':'Compile and run',
  708. 'timeout': 86400,
  709. 'shell':'set -o pipefail && $SHM $DEBUG $TSAN $TSAN_CRASH CRASH_TEST_KILL_ODD=1887 make J=1 crash_test || $CONTRUN_NAME=tsan_crash_test $TASK_CREATION_TOOL',
  710. 'user':'root',
  711. $PARSER
  712. },
  713. $UPLOAD_DB_DIR,
  714. ],
  715. $REPORT
  716. }
  717. ]"
  718. #
  719. # RocksDB crash test with atomic flush under TSAN
  720. #
  721. TSAN_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS="[
  722. {
  723. 'name':'Rocksdb Crash Test with atomic flush under TSAN',
  724. 'oncall':'$ONCALL',
  725. 'executeLocal': 'true',
  726. 'timeout': 86400,
  727. 'steps': [
  728. $CLEANUP_ENV,
  729. {
  730. 'name':'Compile and run',
  731. 'timeout': 86400,
  732. 'shell':'set -o pipefail && $SHM $DEBUG $TSAN $TSAN_CRASH CRASH_TEST_KILL_ODD=1887 make J=1 crash_test_with_atomic_flush || $CONTRUN_NAME=tsan_crash_test_with_atomic_flush $TASK_CREATION_TOOL',
  733. 'user':'root',
  734. $PARSER
  735. },
  736. $UPLOAD_DB_DIR,
  737. ],
  738. $REPORT
  739. }
  740. ]"
  741. #
  742. # RocksDB crash test with txn under TSAN
  743. #
  744. TSAN_CRASH_TEST_WITH_TXN_COMMANDS="[
  745. {
  746. 'name':'Rocksdb Crash Test with txn under TSAN',
  747. 'oncall':'$ONCALL',
  748. 'executeLocal': 'true',
  749. 'timeout': 86400,
  750. 'steps': [
  751. $CLEANUP_ENV,
  752. {
  753. 'name':'Compile and run',
  754. 'timeout': 86400,
  755. 'shell':'set -o pipefail && $SHM $DEBUG $TSAN $TSAN_CRASH CRASH_TEST_KILL_ODD=1887 make J=1 crash_test_with_txn || $CONTRUN_NAME=tsan_crash_test_with_txn $TASK_CREATION_TOOL',
  756. 'user':'root',
  757. $PARSER
  758. },
  759. $UPLOAD_DB_DIR,
  760. ],
  761. $REPORT
  762. }
  763. ]"
  764. #
  765. # RocksDB format compatible
  766. #
  767. run_format_compatible()
  768. {
  769. export TEST_TMPDIR=/dev/shm/rocksdb
  770. rm -rf /dev/shm/rocksdb
  771. mkdir /dev/shm/rocksdb
  772. tools/check_format_compatible.sh
  773. }
  774. FORMAT_COMPATIBLE_COMMANDS="[
  775. {
  776. 'name':'Rocksdb Format Compatible tests',
  777. 'oncall':'$ONCALL',
  778. 'executeLocal': 'true',
  779. 'steps': [
  780. $CLEANUP_ENV,
  781. {
  782. 'name':'Run RocksDB debug unit test',
  783. 'shell':'build_tools/rocksdb-lego-determinator run_format_compatible || $CONTRUN_NAME=run_format_compatible $TASK_CREATION_TOOL',
  784. 'user':'root',
  785. $PARSER
  786. },
  787. ],
  788. $REPORT
  789. }
  790. ]"
  791. #
  792. # RocksDB no compression
  793. #
  794. run_no_compression()
  795. {
  796. export TEST_TMPDIR=/dev/shm/rocksdb
  797. rm -rf /dev/shm/rocksdb
  798. mkdir /dev/shm/rocksdb
  799. make clean
  800. cat build_tools/fbcode_config.sh | grep -iv dzstd | grep -iv dzlib | grep -iv dlz4 | grep -iv dsnappy | grep -iv dbzip2 > .tmp.fbcode_config.sh
  801. mv .tmp.fbcode_config.sh build_tools/fbcode_config.sh
  802. cat Makefile | grep -v tools/ldb_test.py > .tmp.Makefile
  803. mv .tmp.Makefile Makefile
  804. make $DEBUG J=1 check
  805. }
  806. NO_COMPRESSION_COMMANDS="[
  807. {
  808. 'name':'Rocksdb No Compression tests',
  809. 'oncall':'$ONCALL',
  810. 'executeLocal': 'true',
  811. 'steps': [
  812. $CLEANUP_ENV,
  813. {
  814. 'name':'Run RocksDB debug unit test',
  815. 'shell':'build_tools/rocksdb-lego-determinator run_no_compression || $CONTRUN_NAME=run_no_compression $TASK_CREATION_TOOL',
  816. 'user':'root',
  817. $PARSER
  818. },
  819. ],
  820. $REPORT
  821. }
  822. ]"
  823. #
  824. # RocksDB regression
  825. #
  826. run_regression()
  827. {
  828. time -v bash -vx ./build_tools/regression_build_test.sh $(mktemp -d $WORKSPACE/leveldb.XXXX) $(mktemp leveldb_test_stats.XXXX)
  829. # ======= report size to ODS ========
  830. # parameters: $1 -- key, $2 -- value
  831. function send_size_to_ods {
  832. curl --silent "https://www.intern.facebook.com/intern/agent/ods_set.php?entity=rocksdb_build&key=rocksdb.build_size.$1&value=$2" \
  833. --connect-timeout 60
  834. }
  835. # === normal build ===
  836. make clean
  837. make -j$(nproc) static_lib
  838. send_size_to_ods static_lib $(stat --printf="%s" librocksdb.a)
  839. strip librocksdb.a
  840. send_size_to_ods static_lib_stripped $(stat --printf="%s" librocksdb.a)
  841. make -j$(nproc) shared_lib
  842. send_size_to_ods shared_lib $(stat --printf="%s" `readlink -f librocksdb.so`)
  843. strip `readlink -f librocksdb.so`
  844. send_size_to_ods shared_lib_stripped $(stat --printf="%s" `readlink -f librocksdb.so`)
  845. # === lite build ===
  846. make clean
  847. make LITE=1 -j$(nproc) static_lib
  848. send_size_to_ods static_lib_lite $(stat --printf="%s" librocksdb.a)
  849. strip librocksdb.a
  850. send_size_to_ods static_lib_lite_stripped $(stat --printf="%s" librocksdb.a)
  851. make LITE=1 -j$(nproc) shared_lib
  852. send_size_to_ods shared_lib_lite $(stat --printf="%s" `readlink -f librocksdb.so`)
  853. strip `readlink -f librocksdb.so`
  854. send_size_to_ods shared_lib_lite_stripped $(stat --printf="%s" `readlink -f librocksdb.so`)
  855. }
  856. REGRESSION_COMMANDS="[
  857. {
  858. 'name':'Rocksdb regression commands',
  859. 'oncall':'$ONCALL',
  860. 'steps': [
  861. $CLEANUP_ENV,
  862. {
  863. 'name':'Make and run script',
  864. 'shell':'build_tools/rocksdb-lego-determinator run_regression || $CONTRUN_NAME=run_regression $TASK_CREATION_TOOL',
  865. 'user':'root',
  866. $PARSER
  867. },
  868. ],
  869. $REPORT
  870. }
  871. ]"
  872. #
  873. # RocksDB Java build
  874. #
  875. JAVA_BUILD_TEST_COMMANDS="[
  876. {
  877. 'name':'Rocksdb Java Build',
  878. 'oncall':'$ONCALL',
  879. 'executeLocal': 'true',
  880. 'steps': [
  881. $CLEANUP_ENV,
  882. {
  883. 'name':'Build RocksDB for Java',
  884. 'shell':'$SETUP_JAVA_ENV; $SHM make rocksdbjava || $CONTRUN_NAME=rocksdbjava $TASK_CREATION_TOOL',
  885. 'user':'root',
  886. $PARSER
  887. },
  888. ],
  889. $REPORT
  890. }
  891. ]"
  892. case $1 in
  893. unit)
  894. echo $UNIT_TEST_COMMANDS
  895. ;;
  896. unit_non_shm)
  897. echo $UNIT_TEST_NON_SHM_COMMANDS
  898. ;;
  899. release)
  900. echo $RELEASE_BUILD_COMMANDS
  901. ;;
  902. unit_481)
  903. echo $UNIT_TEST_COMMANDS_481
  904. ;;
  905. release_481)
  906. echo $RELEASE_BUILD_COMMANDS_481
  907. ;;
  908. clang_unit)
  909. echo $CLANG_UNIT_TEST_COMMANDS
  910. ;;
  911. clang_release)
  912. echo $CLANG_RELEASE_BUILD_COMMANDS
  913. ;;
  914. clang_analyze)
  915. echo $CLANG_ANALYZE_COMMANDS
  916. ;;
  917. code_cov)
  918. echo $CODE_COV_COMMANDS
  919. ;;
  920. unity)
  921. echo $UNITY_COMMANDS
  922. ;;
  923. lite)
  924. echo $LITE_BUILD_COMMANDS
  925. ;;
  926. report_lite_binary_size)
  927. echo $REPORT_LITE_BINARY_SIZE_COMMANDS
  928. ;;
  929. stress_crash)
  930. echo $STRESS_CRASH_TEST_COMMANDS
  931. ;;
  932. stress_crash_with_atomic_flush)
  933. echo $STRESS_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS
  934. ;;
  935. stress_crash_with_txn)
  936. echo $STRESS_CRASH_TEST_WITH_TXN_COMMANDS
  937. ;;
  938. write_stress)
  939. echo $WRITE_STRESS_COMMANDS
  940. ;;
  941. asan)
  942. echo $ASAN_TEST_COMMANDS
  943. ;;
  944. asan_crash)
  945. echo $ASAN_CRASH_TEST_COMMANDS
  946. ;;
  947. asan_crash_with_atomic_flush)
  948. echo $ASAN_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS
  949. ;;
  950. asan_crash_with_txn)
  951. echo $ASAN_CRASH_TEST_WITH_TXN_COMMANDS
  952. ;;
  953. ubsan)
  954. echo $UBSAN_TEST_COMMANDS
  955. ;;
  956. ubsan_crash)
  957. echo $UBSAN_CRASH_TEST_COMMANDS
  958. ;;
  959. ubsan_crash_with_atomic_flush)
  960. echo $UBSAN_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS
  961. ;;
  962. ubsan_crash_with_txn)
  963. echo $UBSAN_CRASH_TEST_WITH_TXN_COMMANDS
  964. ;;
  965. valgrind)
  966. echo $VALGRIND_TEST_COMMANDS
  967. ;;
  968. tsan)
  969. echo $TSAN_UNIT_TEST_COMMANDS
  970. ;;
  971. tsan_crash)
  972. echo $TSAN_CRASH_TEST_COMMANDS
  973. ;;
  974. tsan_crash_with_atomic_flush)
  975. echo $TSAN_CRASH_TEST_WITH_ATOMIC_FLUSH_COMMANDS
  976. ;;
  977. tsan_crash_with_txn)
  978. echo $TSAN_CRASH_TEST_WITH_TXN_COMMANDS
  979. ;;
  980. format_compatible)
  981. echo $FORMAT_COMPATIBLE_COMMANDS
  982. ;;
  983. run_format_compatible)
  984. run_format_compatible
  985. ;;
  986. no_compression)
  987. echo $NO_COMPRESSION_COMMANDS
  988. ;;
  989. run_no_compression)
  990. run_no_compression
  991. ;;
  992. regression)
  993. echo $REGRESSION_COMMANDS
  994. ;;
  995. run_regression)
  996. run_regression
  997. ;;
  998. java_build)
  999. echo $JAVA_BUILD_TEST_COMMANDS
  1000. ;;
  1001. *)
  1002. echo "Invalid determinator command"
  1003. exit 1
  1004. ;;
  1005. esac