-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test #37
Open
MEKBAL
wants to merge
17
commits into
main
Choose a base branch
from
Test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Test #37
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e76932f
Unitary Tests
MEKBAL f645a29
Fix error of ci.yml
MEKBAL 4040a1c
Add unitary test
MEKBAL 174532d
Add Tests
MEKBAL c77d6e5
Add verificarlo installation
MEKBAL 828d3ee
Add package MPFR
MEKBAL 62f40d1
Fixed test_binary
MEKBAL 084cc4e
Fixed Test_counter
MEKBAL fe6788d
Fixed Test_result
MEKBAL 064d76d
Fixed Test_result
MEKBAL 90a9c1d
rename the backend test
MEKBAL 6b29c41
Adapt to the new backend names
MEKBAL 00a42a9
add newline at the end of the file
MEKBAL 6c9e85d
remove test execution for verificarlo
MEKBAL 31c8300
add end of ligne character
MEKBAL 3d954f8
Added parameters for launching tests separately
MEKBAL 2759b4b
update CI
MEKBAL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
name: CI ADAPTER | ||
|
||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
|
||
jobs: | ||
Linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: using the Checkout action | ||
uses: actions/checkout@v2 | ||
- name: Get latest CMake | ||
uses: lukka/get-cmake@latest | ||
- name: Install python packages | ||
run: python -m pip install Jinja2 make pytest | ||
- name: Install requirements for Verrou | ||
run: sudo apt-get -qq update; sudo apt-get install -y libc-dbg | ||
- name: Install requirements for building | ||
run: sudo apt-get install -y build-essential g++ gcc autoconf automake | ||
- name: Install requirements for verificarlo | ||
run: sudo apt install clang lldb lld llvm opt libtool libmpfr-dev parallel | ||
- name: Install Verificarlo | ||
run: | | ||
git clone https://github.com/verificarlo/verificarlo.git | ||
cd verificarlo | ||
./autogen.sh | ||
./configure --without-flang | ||
sudo make | ||
sudo make install | ||
- name: clone PENE | ||
run: | | ||
cd pene_files | ||
git clone https://github.com/aneoconsulting/PENE.git | ||
- name: runing cmake for Verificarlo and PENE tools (Linux) | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -DBUILD_FOR_PENE=ON -DBUILD_FOR_VERIFICARLO=ON | ||
- name: Building (Linux) | ||
run : | | ||
cd build | ||
cmake --build . | ||
- name: Testing (Linux) | ||
run : | | ||
cd Test | ||
mkdir build | ||
cd build | ||
cmake .. -DTEST_PENE=ON | ||
make | ||
ctest -C Debug --output-o-failure | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
cmake_minimum_required(VERSION 3.12) | ||
|
||
project(Tests_All_Frontend) | ||
|
||
|
||
set(CMAKE_GENERICS_PATH "${CMAKE_SOURCE_DIR}") | ||
|
||
enable_testing() | ||
|
||
add_subdirectory("Test_result") | ||
add_subdirectory("Test_counter") | ||
add_subdirectory("Test_binary") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
configure_file(${INFILE} ${OUTFILE}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
|
||
cmake_minimum_required (VERSION 3.20) | ||
|
||
project(Test_binary) | ||
|
||
find_package(Python3 COMPONENTS Interpreter REQUIRED) | ||
|
||
add_executable(test_verificarlo_bin executable.cpp) | ||
add_executable(test_verrou_bin executable.cpp) | ||
|
||
set_property(TARGET test_verrou_bin PROPERTY CXX_STANDARD 17) | ||
|
||
set(PYTHON_SCRIPT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test_binary.py) | ||
get_filename_component(PARENT_DIR ${CMAKE_SOURCE_DIR} DIRECTORY) | ||
get_filename_component(GRANDPARENT_DIR ${PARENT_DIR} DIRECTORY) | ||
set(PIN_PATH ${PARENT_DIR}/pene_files/PENE/Pin/Linux/pin) | ||
set(LIB_PATH ${PARENT_DIR}/pene_files/PENE/src/libpene.so) | ||
|
||
# set(CMAKE_GENERICS_PATH "${CMAKE_SOURCE_DIR}") | ||
|
||
|
||
set(new_back_verificarlo ${PARENT_DIR}/verificarlo_files/backends_so/libtarget_backend_test_1.so) | ||
|
||
set(TOOL_PATH ${PARENT_DIR}/pene_files/PENE/cmake/tools) | ||
|
||
add_custom_command( | ||
#OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/verificarlo_exe | ||
TARGET test_verificarlo_bin | ||
PRE_BUILD | ||
COMMAND verificarlo-c++ ${CMAKE_CURRENT_SOURCE_DIR}/executable.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/verificarlo_exe | ||
COMMENT "Building verificarlo_exe" | ||
) | ||
|
||
|
||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_binary.py | ||
COMMAND ${CMAKE_COMMAND} | ||
-D INFILE=${CMAKE_CURRENT_SOURCE_DIR}/test_binary.py | ||
-D OUTFILE=${CMAKE_CURRENT_BINARY_DIR}/test_binary.py | ||
-D REPLACE_TESTS_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} | ||
-D VERIFICARLO_EXECUTABLE=${CMAKE_CURRENT_BINARY_DIR}/verificarlo_exe | ||
-D BACKEND_VERIFICARLO=${new_back_verificarlo} | ||
-D VERROU_EXECUTABLE=$<TARGET_FILE:test_verrou_bin> | ||
-D LIB=${LIB_PATH} | ||
-D PIN_EXECUTABLE=${PIN_PATH} | ||
-P ${CMAKE_GENERICS_PATH}/GenericConfigureFile.cmake | ||
DEPENDS | ||
${CMAKE_GENERICS_PATH}/GenericConfigureFile.cmake | ||
COMMENT "Configuring test_binary.py" | ||
VERBATIM | ||
) | ||
|
||
|
||
set(TEST_SCRIPTS test_binary.py) | ||
|
||
list(TRANSFORM TEST_SCRIPTS PREPEND ${CMAKE_CURRENT_BINARY_DIR}/) | ||
add_custom_target(${PROJECT_NAME} ALL DEPENDS | ||
${TEST_SCRIPTS} | ||
${CMAKE_CURRENT_BINARY_DIR}/test_binary.py | ||
) | ||
|
||
enable_testing() | ||
|
||
|
||
option(TEST_PENE "Enable testing for PENE" OFF) | ||
option(TEST_VERIFICARLO "Enable testing for Verificarlo" OFF) | ||
|
||
set(PENE_TESTS test_binary_PENE) | ||
set(VERIFICARLO_TESTS test_binary_Verificarlo) | ||
|
||
set(TEST_LIST) | ||
|
||
if(TEST_PENE) | ||
list(APPEND TEST_LIST ${PENE_TESTS}) | ||
endif() | ||
|
||
if(TEST_VERIFICARLO) | ||
list(APPEND TEST_LIST ${VERIFICARLO_TESTS}) | ||
endif() | ||
|
||
if(NOT "${TEST_LIST}" STREQUAL "") | ||
foreach(test ${TEST_LIST}) | ||
add_test(NAME ${test} | ||
COMMAND ${Python3_EXECUTABLE} -m pytest -k ${test} ${CMAKE_CURRENT_BINARY_DIR}/test_binary.py | ||
) | ||
endforeach() | ||
else() | ||
message(WARNING "No tests specified. Please enable either TEST_PENE or TEST_VERIFICARLO to run specific tests.") | ||
endif() | ||
|
||
|
||
include_directories("../../pene_files/PENE/Pin/Linux") | ||
include_directories("../../pene_files/PENE/src") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
|
||
#include <immintrin.h> | ||
#include <iostream> | ||
#include <string> | ||
#include <iomanip> | ||
|
||
int main(){ | ||
|
||
std::cout<< "This programme is used for tests the instrumentation of the programme with the three tools" << std::endl; | ||
|
||
float z = 1.0; | ||
float x = 0.0; | ||
|
||
float sum = z+x; | ||
|
||
std::cout << "Result :" << std::endl; | ||
std::cout << std::setprecision(23) << std::hexfloat << sum << std::endl; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
|
||
|
||
import pytest | ||
import re | ||
import subprocess | ||
from pathlib import Path | ||
import sys | ||
import os | ||
|
||
class Test_front(): | ||
|
||
verificarlo = "@VERIFICARLO_EXECUTABLE@" | ||
verrou = "@VERROU_EXECUTABLE@" | ||
pin = "@PIN_EXECUTABLE@" | ||
lib = "@LIB@" | ||
new_back = "@BACKEND_VERIFICARLO@" | ||
|
||
expected = r"0x1\.000002p\+0" | ||
|
||
def launch_PENE(self): | ||
|
||
cmdLine = ("{pin} -t {tool} -fp-replace 5 -counter_mode 1 -- {executable}").format(pin = self.pin, | ||
tool = self.lib, | ||
executable = self.verrou, | ||
) | ||
|
||
|
||
out = subprocess.run(cmdLine.split(" "), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
|
||
output = out.stdout.decode('utf-8') | ||
print(output) | ||
|
||
p = r"\A=*[\r\n]{1,2}\s*?PENE: Pin Enabled Numerical Exploration\s*?[\r\n]{1,2}=*[\r\n]{1,2}" | ||
assert re.search(p, output) is not None, f"failed to launch instrumentation with PENE" | ||
|
||
return output | ||
|
||
|
||
def launch_verificarlo(self): | ||
|
||
command = ("VFC_BACKENDS=\"{back} --count-op\" {verificarlo}").format(back=self.new_back, | ||
verificarlo=self.verificarlo, | ||
) | ||
|
||
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
|
||
output, error = process.communicate() | ||
|
||
output_str = output.decode("utf-8") | ||
print(output_str) | ||
|
||
p = r"loaded backend" | ||
assert re.search(p, output_str) is not None, f"failed to launch instrumentation with Verificarlo" | ||
|
||
return output_str | ||
|
||
def checkout_binary(self, pattern, expected): | ||
|
||
p = re.compile(expected) | ||
|
||
res = p.search(pattern) | ||
assert res, "The result is false" | ||
|
||
|
||
def test_binary_PENE(self): | ||
|
||
output=self.launch_PENE() | ||
self.checkout_binary(output, self.expected) | ||
|
||
def test_binary_Verificarlo(self): | ||
|
||
output=self.launch_verificarlo() | ||
self.checkout_binary(output, self.expected) | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.main() | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't there a way to reduce redundancy of CMaksLists? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, there is non way. |
||
|
||
|
||
cmake_minimum_required (VERSION 3.20) | ||
|
||
project(Test_Counter) | ||
|
||
find_package(Python3 COMPONENTS Interpreter REQUIRED) | ||
|
||
add_executable(test_verificarlo Test_Frontend_executable.cpp) | ||
add_executable(test_verrou Test_Frontend_executable.cpp) | ||
|
||
set_property(TARGET test_verrou PROPERTY CXX_STANDARD 17) | ||
|
||
set(PYTHON_SCRIPT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test_counter.py) | ||
get_filename_component(PARENT_DIR ${CMAKE_SOURCE_DIR} DIRECTORY) | ||
get_filename_component(GRANDPARENT_DIR ${PARENT_DIR} DIRECTORY) | ||
get_filename_component(GRAND_GRAND_DIR ${GRANDPARENT_DIR} DIRECTORY) | ||
set(PIN_PATH ${PARENT_DIR}/pene_files/PENE/Pin/Linux/pin) | ||
set(LIB_PATH ${PARENT_DIR}/pene_files/PENE/src/libpene.so) | ||
|
||
# set(CMAKE_GENERICS_PATH "${CMAKE_SOURCE_DIR}") | ||
|
||
set(new_back_verificarlo ${PARENT_DIR}/verificarlo_files/backends_so/libtarget_backend_test_2.so) | ||
|
||
set(TOOL_PATH ${PARENT_DIR}/pene_files/PENE/cmake/tools) | ||
|
||
add_custom_command( | ||
TARGET test_verificarlo | ||
PRE_BUILD | ||
COMMAND verificarlo-c++ ${CMAKE_CURRENT_SOURCE_DIR}/Test_Frontend_executable.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/verificarlo_exe | ||
COMMENT "Building verificarlo_exe" | ||
) | ||
|
||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_counter.py | ||
COMMAND ${CMAKE_COMMAND} | ||
-D INFILE=${CMAKE_CURRENT_SOURCE_DIR}/test_counter.py | ||
-D OUTFILE=${CMAKE_CURRENT_BINARY_DIR}/test_counter.py | ||
-D REPLACE_TESTS_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} | ||
-D VERIFICARLO_EXECUTABLE=${CMAKE_CURRENT_BINARY_DIR}/verificarlo_exe | ||
-D BACKEND_VERIFICARLO=${new_back_verificarlo} | ||
-D VERROU_EXECUTABLE=$<TARGET_FILE:test_verrou> | ||
-D LIB=${LIB_PATH} | ||
-D PIN_EXECUTABLE=${PIN_PATH} | ||
-P ${CMAKE_GENERICS_PATH}/GenericConfigureFile.cmake | ||
DEPENDS | ||
${CMAKE_GENERICS_PATH}/GenericConfigureFile.cmake | ||
COMMENT "Configuring test_replace.py" | ||
VERBATIM | ||
) | ||
|
||
|
||
set(TEST_SCRIPTS test_counter.py) | ||
|
||
list(TRANSFORM TEST_SCRIPTS PREPEND ${CMAKE_CURRENT_BINARY_DIR}/) | ||
add_custom_target(${PROJECT_NAME} ALL DEPENDS | ||
${TEST_SCRIPTS} | ||
${CMAKE_CURRENT_BINARY_DIR}/test_counter.py | ||
) | ||
|
||
enable_testing() | ||
|
||
|
||
option(TEST_PENE "Enable testing for PENE" OFF) | ||
option(TEST_VERIFICARLO "Enable testing for Verificarlo" OFF) | ||
|
||
set(PENE_TESTS test_Nbr_Op_PENE) | ||
set(VERIFICARLO_TESTS test_Nbr_Op_Verificarlo) | ||
|
||
set(TEST_LIST) | ||
|
||
if(TEST_PENE) | ||
list(APPEND TEST_LIST ${PENE_TESTS}) | ||
endif() | ||
|
||
if(TEST_VERIFICARLO) | ||
list(APPEND TEST_LIST ${VERIFICARLO_TESTS}) | ||
endif() | ||
|
||
|
||
if(NOT "${TEST_LIST}" STREQUAL "") | ||
foreach(test ${TEST_LIST}) | ||
add_test(NAME ${test} | ||
COMMAND ${Python3_EXECUTABLE} -m pytest -k ${test} ${CMAKE_CURRENT_BINARY_DIR}/test_counter.py | ||
) | ||
endforeach() | ||
else() | ||
message(WARNING "No tests specified. Please enable either TEST_PENE or TEST_VERIFICARLO to run specific tests.") | ||
endif() | ||
|
||
|
||
include_directories("../../../pene_files/PENE/Pin/Linux") | ||
include_directories("../../../pene_files/PENE/src") |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the execution of a frontend depending on arguments and only giving PENE as parameter ?