Don't miss the great looking dashboard here:
https://nemo.sonarqube.org/overview?id=simgrid
+This tool is enriched by the script @c tools/internal/travis-sonarqube.sh
+that is run from @c .travis.yml
+
*/
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mc/")
- foreach(x bcbench mvmul replay trace trace_simple energy)
+ foreach(x bcbench mvmul replay trace trace_simple trace_call_location energy)
add_executable (smpi_${x} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
target_link_libraries(smpi_${x} simgrid)
set_target_properties(smpi_${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
endforeach()
+ set_target_properties(smpi_trace_call_location PROPERTIES COMPILE_FLAGS "-trace-call-location")
+
foreach(x bugged1 bugged2 bugged1_liveness only_send_deterministic mutual_exclusion non_termination1
non_termination2 non_termination3 non_termination4)
if(HAVE_MC)
add_executable (smpi_${x} ${CMAKE_CURRENT_SOURCE_DIR}/mc/${x}.c)
target_link_libraries(smpi_${x} simgrid)
set_target_properties(smpi_${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mc)
- endif()
+ endif()
set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/mc/${x}.c)
endforeach()
endif()
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/energy/energy.tesh
${CMAKE_CURRENT_SOURCE_DIR}/trace/trace.tesh
${CMAKE_CURRENT_SOURCE_DIR}/trace_simple/trace_simple.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/trace_call_location/trace_call_location.tesh
${CMAKE_CURRENT_SOURCE_DIR}/replay/replay.tesh PARENT_SCOPE)
set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
${CMAKE_CURRENT_SOURCE_DIR}/energy/hostfile
ADD_TESH(smpi-tracing --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace/trace.tesh)
ADD_TESH(smpi-tracing-simple --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_simple/trace_simple.tesh)
+ ADD_TESH(smpi-tracing-call-location --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_call_location/trace_call_location.tesh)
ADD_TESH(smpi-replay --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/replay.tesh)
ADD_TESH_FACTORIES(smpi-energy "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/energy.tesh)
endif()
--- /dev/null
+/* Copyright (c) 2012, 2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdio.h>
+#include <mpi.h>
+
+/* test*/
+int main(int argc, char *argv[])
+{
+ MPI_Init(&argc, &argv);
+ MPI_Barrier (MPI_COMM_WORLD);
+ MPI_Finalize();
+ return 0;
+}
--- /dev/null
+# use the tested library, not the installed one
+# (since we want to pass it to the child, it has to be redefined before each command)
+# Go for the first test
+
+p Test SMPI with call-location tracing. This means that the binary must have
+p already been compiled with the -trace-call-location switch.
+$ ../../smpi_script/bin/smpirun -trace -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=smpi/trace-call-location:1 -np 3 ./trace_call_location/smpi_trace_call_location --log=smpi_kernel.thres:warning
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'smpi_trace.trace'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/smpi' to 'yes'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'surf/precision' to '1e-9'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP-gamma' to '4194304'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/trace-call-location' to '1'
+
+$ grep --quiet "12 0.000000 2 1 5 .*trace_call_location\.c\" 14$" smpi_trace.trace
+
+$ rm -f smpi_trace.trace
// This file has been automatically generated by the script
// in tools/smpi/./generate_smpi_defines.pl
// DO NOT EDIT MANUALLY. ALL CHANGES WILL BE OVERWRITTEN!
-#define MPI_Init(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init(__VA_ARGS__); })
+#define MPI_Init(...) ({ smpi_process_init(__VA_ARGS__); smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init(NULL, NULL); })
#define MPI_Finalize(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Finalize(__VA_ARGS__); })
#define MPI_Finalized(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Finalized(__VA_ARGS__); })
#define MPI_Init_thread(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init_thread(__VA_ARGS__); })
# Comma-separated paths to directories with sources (required)
sonar.sources=src,examples,include,teshsuite
-# Exclude out unit tests from the analysis
-sonar.exclusions=src/*_unit.c,src/*_unit.cpp
-# Exclude the tests that we borrowed elsewhere
-sonar.exclusions=teshsuite/smpi/mpich3-test/*,teshsuite/smpi/isp/*
+# Exclude some files from the analysis:
+# - our unit tests
+# - the tests that we borrowed elsewhere (MPICH and ISP)
+sonar.exclusions=src/*_unit.c*,teshsuite/smpi/mpich3-test/*,teshsuite/smpi/isp/*
# The build-wrapper output dir
sonar.cfamily.build-wrapper-output=bw-outputs
// PMPI_Init is call only one time by only by SMPI process
int already_init;
MPI_Initialized(&already_init);
- if(!(already_init)){
+ if(already_init == 0){
smpi_process_init(argc, argv);
smpi_process_mark_as_initialized();
int rank = smpi_process_index();
exit 0
;;
'-trace-call-location')
- list_add_not_empty CMDLINE "-DTRACE_CALL_LOCATION"
+ list_add_not_empty CMDARGS "-DTRACE_CALL_LOCATION"
;;
'-compiler-version' | '--compiler-version')
${CC} --version
installBuildWrapper
# triggers the compilation through the build wrapper to gather compilation database
-# We need to clean the build that was used for the tests before to ensure that everything gets rebuilt:
-# sonarqube only use what's built throught its wrappers
+# We need to clean the build that was used for the tests before to ensure that everything gets rebuilt (sonarqube only use what's built throught its wrappers)
+# Plus, we need to activate MC so that it does not get throught the quality net :)
make clean
+cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=ON -Denable_model-checking=ON -Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF .
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make all
# and finally execute the actual SonarQube analysis (the SONAR_TOKEN is set from the travis web interface, to not expose it)
print "#define ". uc($id) ." smpi_trace_set_call_location(__FILE__,__LINE__); call ". lc $id ."\n";
}
else {
- print "#define $id(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); $id(__VA_ARGS__); })\n";
+ if ($id eq "MPI_Init") {
+ print "#define MPI_Init(...) ({ smpi_process_init(__VA_ARGS__); smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init(NULL, NULL); })\n";
+ }
+ else {
+ print "#define $id(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); $id(__VA_ARGS__); })\n";
+ }
}
}