Skip to content

Commit

Permalink
Generated from commit bfd3e0c3972ebfe0508237e05a2ebb4bb0bc4164
Browse files Browse the repository at this point in the history
  • Loading branch information
Pusnow committed Mar 29, 2022
1 parent f7d1641 commit f939818
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 35 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.11)

project(e VERSION 3.3.1)
project(e VERSION 3.3.2)

if(WIN32)
message(
Expand Down
82 changes: 52 additions & 30 deletions app/kens/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,68 @@ get_solution(kens)

# Tests

set(kens_part1_SOURCES testopen.cpp testbind.cpp)
set(kens_part2_SOURCES testhandshake.cpp testclose.cpp)
set(kens_part3_SOURCES testtransfer.cpp)
set(kens_part4_SOURCES testcongestion.cpp)
set(kens_all_SOURCES ${kens_part1_SOURCES} ${kens_part2_SOURCES}
${kens_part3_SOURCES} ${kens_part4_SOURCES})

set(test_open_SOURCES testopen.cpp)
set(test_bind_SOURCES testbind.cpp)
set(test_handshake_SOURCES testhandshake.cpp)
set(test_close_SOURCES testclose.cpp)
set(test_transfer_SOURCES testtransfer.cpp)
set(test_congestion_SOURCES testcongestion.cpp)
set(test_all_SOURCES testopen.cpp testbind.cpp testhandshake.cpp testclose.cpp
testtransfer.cpp testcongestion.cpp)

set(kens-targets kens)

if (TARGET kens-ref)
list(APPEND kens-targets kens-ref)
if(TARGET kens-ref)
list(APPEND kens-targets kens-ref)
endif()


foreach(kens-traget ${kens-targets})
foreach(part part1 part2 part3 part4 all)
add_executable(${kens-traget}-${part} testenv.hpp ${kens_${part}_SOURCES})
target_link_libraries(${kens-traget}-${part} ${kens-traget} kens_solution gtest_main)
add_executable(${kens-traget}-${part}-unreliable testenv.hpp ${kens_${part}_SOURCES})
target_link_libraries(${kens-traget}-${part}-unreliable ${kens-traget} kens_solution gtest_main)
add_executable(${kens-traget}-${part}-run-solution testenv.hpp ${kens_${part}_SOURCES})
target_link_libraries(${kens-traget}-${part}-run-solution ${kens-traget} kens_solution gtest_main)
add_executable(${kens-traget}-${part}-unreliable-run-solution testenv.hpp
${kens_${part}_SOURCES})
target_link_libraries(${kens-traget}-${part}-unreliable-run-solution ${kens-traget} kens_solution gtest_main)

target_compile_definitions(${kens-traget}-${part}-run-solution PRIVATE RUN_SOLUTION)
target_compile_definitions(${kens-traget}-${part}-unreliable-run-solution
PRIVATE RUN_SOLUTION UNRELIABLE)
target_compile_definitions(${kens-traget}-${part}-unreliable PRIVATE UNRELIABLE)
foreach(
part
open
bind
handshake
close
transfer
congestion
all)

add_executable(test-${kens-traget}-${part} testenv.hpp
${test_${part}_SOURCES})
target_link_libraries(test-${kens-traget}-${part} ${kens-traget}
kens_solution gtest_main)
add_executable(test-${kens-traget}-${part}-unreliable
testenv.hpp ${test_${part}_SOURCES})
target_link_libraries(test-${kens-traget}-${part}-unreliable ${kens-traget}
kens_solution gtest_main)
add_executable(test-${kens-traget}-${part}-run-solution
testenv.hpp ${test_${part}_SOURCES})
target_link_libraries(test-${kens-traget}-${part}-run-solution
${kens-traget} kens_solution gtest_main)
add_executable(test-${kens-traget}-${part}-unreliable-run-solution
testenv.hpp ${test_${part}_SOURCES})
target_link_libraries(test-${kens-traget}-${part}-unreliable-run-solution
${kens-traget} kens_solution gtest_main)

target_compile_definitions(test-${kens-traget}-${part}-run-solution
PRIVATE RUN_SOLUTION)
target_compile_definitions(
test-${kens-traget}-${part}-unreliable-run-solution PRIVATE RUN_SOLUTION
UNRELIABLE)
target_compile_definitions(test-${kens-traget}-${part}-unreliable
PRIVATE UNRELIABLE)

if(${CMAKE_VERSION} VERSION_GREATER "3.13.0")
set_target_properties(
${kens-traget}-${part} ${kens-traget}-${part}-run-solution ${kens-traget}-${part}-unreliable
${kens-traget}-${part}-unreliable-run-solution PROPERTIES XCODE_GENERATE_SCHEME ON)
test-${kens-traget}-${part} test-${kens-traget}-${part}-run-solution
test-${kens-traget}-${part}-unreliable
test-${kens-traget}-${part}-unreliable-run-solution
PROPERTIES XCODE_GENERATE_SCHEME ON)
set_target_properties(
${kens-traget}-${part} ${kens-traget}-${part}-run-solution ${kens-traget}-${part}-unreliable
${kens-traget}-${part}-unreliable-run-solution PROPERTIES XCODE_SCHEME_ENVIRONMENT
"GTEST_COLOR=no")
test-${kens-traget}-${part} test-${kens-traget}-${part}-run-solution
test-${kens-traget}-${part}-unreliable
test-${kens-traget}-${part}-unreliable-run-solution
PROPERTIES XCODE_SCHEME_ENVIRONMENT "GTEST_COLOR=no")
endif()
endforeach(part)
endforeach(kens-traget)
8 changes: 4 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fi

function grade() {
if [ "$#" -lt 2 ]; then
echo "Usage: grade [app_name] [parts ...]"
echo "Usage: grade [app_name] [binaries ...]"
exit 1
fi
echo "Grading $1: ${*:2}"
Expand All @@ -25,9 +25,9 @@ function grade() {
RANDOM_SEED=${RANDOM_SEED:-0}
TIMEOUT=${TIMEOUT:-300}
for seed in ${RANDOM_SEED//,/ }; do
for part in "${@:2}"; do
for test in $("./app/$1/$1-$part" --gtest_list_tests | grep '^ *'); do
timeout ${TIMEOUT} GTEST_OUTPUT="xml:/xml/${1}_${part}_${seed}_${test}.xml" RANDOM_SEED=$seed "./app/$1/$1-$part" --gtest_filter="*$test"
for binary in "${@:2}"; do
for test in $("./app/$1/$binary" --gtest_list_tests | grep '^ *'); do
timeout ${TIMEOUT} GTEST_OUTPUT="xml:/xml/${1}_${binary}_${seed}_${test}.xml" RANDOM_SEED=$seed "./app/$1/$binary" --gtest_filter="*$test"
done
done
done
Expand Down

0 comments on commit f939818

Please sign in to comment.