Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxiao1254 committed May 10, 2021
1 parent 1e4d644 commit 24d141e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 25 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
os: [ubuntu-latest]
build_type: [Debug, Release]
runs-on: [self-hosted]
timeout-minutes: 30
env:
BUILD_TYPE: ${{matrix.build_type}}
steps:
Expand All @@ -22,7 +23,4 @@ jobs:
- name: Test
shell: bash
run: |
./run ./bin/bit
./run ./bin/int
./run ./bin/float
./run ./bin/repeat
make test
6 changes: 2 additions & 4 deletions .github/workflows/x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
os: [ubuntu-latest, macos-latest]
build_type: [Debug, Release]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
BUILD_TYPE: ${{matrix.build_type}}
steps:
Expand All @@ -22,7 +23,4 @@ jobs:
- name: Test
shell: bash
run: |
./run ./bin/bit
./run ./bin/int
./run ./bin/float
./run ./bin/repeat
make test
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

install_manifest.txt
Testing/
*.DS_Store
*.txt.cpp
*CTestTestfile.cmake
*perf.data*
CMakeCache.txt
CMakeFiles/
Makefile
bin/
cmake_install.cmake
install_manifest.txt
# Compiled Object files
*.slo
*.lo
Expand Down Expand Up @@ -33,3 +37,15 @@ cmake_install.cmake
*.exe
*.out
*.app

# Emacs
*~

# CMake generated .h files
emp-ot/latticeInclude.h

# Eigen source
eigen/

# VOLE COT data file
data/
15 changes: 2 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,5 @@ include_directories(${EMP-OT_INCLUDE_DIRS})
install(FILES cmake/emp-sh2pc-config.cmake DESTINATION cmake/)
install(DIRECTORY emp-sh2pc DESTINATION include/)

# Test cases
macro (add_test _name)
add_test_with_lib(${_name} ${EMP-OT_LIBRARIES})
endmacro()

add_test (bit)
add_test (int)
IF(${ENABLE_FLOAT})
add_test (float)
ENDIF(${ENABLE_FLOAT})
add_test (circuit_file)
add_test (example)
add_test (repeat)
ENABLE_TESTING()
ADD_SUBDIRECTORY(test)
26 changes: 26 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#Testing macro
macro (add_test_executable_with_lib _name libs)
add_executable(test_${_name} "${_name}.cpp")
target_link_libraries(test_${_name} ${EMP-OT_LIBRARIES})
endmacro()

macro (add_test_case _name)
add_test_executable_with_lib(${_name} "")
add_test(NAME ${_name} COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${_name}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/")
endmacro()

macro (add_test_case_with_run _name)
add_test_executable_with_lib(${_name} "")
add_test(NAME ${_name} COMMAND "./run" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${_name}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/")

endmacro()

# Test cases
add_test_case_with_run(bit)
add_test_case_with_run(int)
IF(${ENABLE_FLOAT})
add_test_case_with_run(float)
ENDIF(${ENABLE_FLOAT})
add_test_case_with_run(circuit_file)
add_test_case_with_run(example)
add_test_case_with_run(repeat)
5 changes: 4 additions & 1 deletion test/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ void test_sort(int party) {
int main(int argc, char** argv) {
int port, party;
parse_party_and_port(argv, &party, &port);
int num = 20;
if(argc > 3)
num = atoi(argv[3]);
NetIO * io = new NetIO(party==ALICE ? nullptr : "127.0.0.1", port);

setup_semi_honest(io, party);
test_millionare(party, atoi(argv[3]));
test_millionare(party, num);
// test_sort(party);
cout << CircuitExecution::circ_exec->num_and()<<endl;
finalize_semi_honest();
Expand Down
2 changes: 1 addition & 1 deletion test/int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using namespace emp;
using namespace std;

template<typename Op, typename Op2>
void test_int(int party, int range1 = 1<<25, int range2 = 1<<25, int runs = 10000) {
void test_int(int party, int range1 = 1<<20, int range2 = 1<<20, int runs = 10000) {
PRG prg(fix_key);
for(int i = 0; i < runs; ++i) {
long long ia, ib;
Expand Down

0 comments on commit 24d141e

Please sign in to comment.