generate-lox-results.sh 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/bash
  2. ncpus=""
  3. cpurange=""
  4. while [ -n "$1" ]; do
  5. if [ "$1" == "-n" ]; then
  6. ncpus="$2"
  7. shift
  8. elif [ "$1" == "-N" ]; then
  9. cpurange="$2"
  10. shift
  11. fi
  12. shift
  13. done
  14. if [ -z "$ncpus" ]; then
  15. ncpus=$(nproc)
  16. fi
  17. if [ -z "$cpurange" ]; then
  18. cpurange="0-$((ncpus - 1))"
  19. fi
  20. hosts=()
  21. for i in {1..5}; do
  22. hosts+=(lox-old)
  23. done
  24. for i in {1..5}; do
  25. hosts+=(lox-new)
  26. done
  27. for i in {1..6}; do
  28. hosts+=(troll-patrol)
  29. done
  30. cmds=(
  31. "cargo test --release --features fast -- --nocapture stats_test_trust_levels > trust_levels.log"
  32. "cargo test --release --features fast -- --nocapture stats_test_invitations > invitations.log"
  33. "cargo test --release --features fast -- --nocapture stats_test_percent_blockage_migration_05 > blockage_migration05.log"
  34. "cargo test --release --features fast -- --nocapture stats_test_percent_blockage_migration_50 > blockage_migration50.log"
  35. "cargo test --release --features fast -- --nocapture stats_test_percent_blockage_migration_100 > blockage_migration100.log"
  36. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_trust_levels > trust_levels.log"
  37. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_invitations > invitations.log"
  38. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_percent_blockage_migration_05 > blockage_migration05.log"
  39. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_percent_blockage_migration_50 > blockage_migration50.log"
  40. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_percent_blockage_migration_100 > blockage_migration100.log"
  41. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_reporting > reporting.log"
  42. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_trust_levels > trust_levels.log"
  43. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_invitations > invitations.log"
  44. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_percent_blockage_migration_05 > blockage_migration05.log"
  45. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_percent_blockage_migration_50 > blockage_migration50.log"
  46. "cargo test --release --features bridgeauth,test,fast -- --nocapture stats_test_percent_blockage_migration_100 > blockage_migration100.log"
  47. )
  48. index=0
  49. i=0
  50. for i in ${!cmds[@]}; do
  51. cmd="${cmds[$i]}"
  52. file="${cmd##* }"
  53. host="${hosts[$i]}"
  54. echo "Starting command ${cmd} with docker image ${host} with index ${index}..."
  55. # New container
  56. docker run --name "${host}-${file}" --rm -d -i "${host}:latest" || exit 1
  57. # Run command in this docker
  58. docker exec "${host}-${file}" numactl -C "$cpurange" numactl -C +$index sh -c "$cmd" &
  59. index=$((index + 1))
  60. echo "Command started and pushed to background."
  61. if [ $index == "$ncpus" ]; then
  62. echo "Waiting for the first $ncpus commands to complete..."
  63. wait
  64. index=0
  65. fi
  66. done
  67. wait
  68. # Extract log files from docker containers and shut them down
  69. mkdir -p parsing-results/{lox-old,lox-new,troll-patrol}
  70. for i in {0..4}; do
  71. cmd="${cmds[$i]}"
  72. file="${cmd##* }"
  73. host="${hosts[$i]}"
  74. docker cp "${host}-${file}":/home/lox/"${file}" parsing-results/lox-old/ && docker stop "${host}-${file}"
  75. done
  76. for i in {5..15}; do
  77. cmd="${cmds[$i]}"
  78. file="${cmd##* }"
  79. host="${hosts[$i]}"
  80. docker cp "${host}-${file}":/home/lox/crates/lox-extensions/"${file}" parsing-results/${host}/ && docker stop "${host}-${file}"
  81. done