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
RawContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func,
smx_process_t process);
- ~RawContext();
+ ~RawContext() override;
public:
static void wrapper(void* arg);
void stop() override;
class RawContextFactory : public ContextFactory {
public:
RawContextFactory();
- ~RawContextFactory();
+ ~RawContextFactory() override;
RawContext* create_context(std::function<void()> code,
void_pfn_smxprocess_t, smx_process_t process) override;
void run_all() override;
ThreadContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func,
smx_process_t process, bool maestro =false);
- ~ThreadContext();
+ ~ThreadContext() override;
void stop() override;
void suspend() override;
void attach_start() override;
class ThreadContextFactory : public ContextFactory {
public:
ThreadContextFactory();
- ~ThreadContextFactory();
- virtual ThreadContext* create_context(std::function<void()> code,
+ ~ThreadContextFactory() override;
+ ThreadContext* create_context(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func, smx_process_t process) override;
void run_all() override;
ThreadContext* self() override;
friend UContextFactory;
UContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func, smx_process_t process);
- ~UContext();
+ ~UContext() override;
};
class SerialUContext : public UContext {
friend ParallelUContext;
UContextFactory();
- virtual ~UContextFactory();
- virtual Context* create_context(std::function<void()> code,
+ ~UContextFactory() override;
+ Context* create_context(std::function<void()> code,
void_pfn_smxprocess_t, smx_process_t process) override;
void run_all() override;
};
namespace simix {
XBT_PUBLIC_CLASS Comm : public Synchro {
- ~Comm();
+ ~Comm() override;
public:
Comm(e_smx_comm_type_t type);
void suspend() override;
namespace simix {
XBT_PUBLIC_CLASS Exec : public Synchro {
- ~Exec();
+ ~Exec() override;
public:
Exec(const char*name, sg_host_t host);
void suspend() override;
/** Used to implement mutexes, semaphores and conditions */
XBT_PUBLIC_CLASS Raw : public Synchro {
public:
- ~Raw();
+ ~Raw() override;
void suspend() override;
void resume() override;
void post() override;
// 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
set(warnCFLAGS "")
set(optCFLAGS "")
-
+set(warnCXXFLAGS "")
if(enable_compile_warnings)
set(warnCFLAGS "-fno-common -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
set(warnCFLAGS "${warnCFLAGS} -Wclobbered -Wno-error=clobbered -Wno-unused-local-typedefs -Wno-error=attributes")
endif()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
+ set(warnCXXFLAGS "${warnCFLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wclobbered -Wno-error=clobbered -Wno-unused-local-typedefs -Wno-error=attributes")
+ set(warnCXXFLAGS "${warnCXXFLAGS} -Wclobbered -Wno-error=clobbered -Wno-unused-local-typedefs -Wno-error=attributes")
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # don't care about class that become struct
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags")
+ set(warnCXXFLAGS "${warnCXXFLAGS} -Wno-mismatched-tags")
endif()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "-DNDEBUG ${CMAKE_CXX_FLAGS}")
endif()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${optCFLAGS} ${warnCFLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${optCFLAGS}")
+set(CMAKE_C_FLAGS "${warnCFLAGS} ${CMAKE_C_FLAGS} ${optCFLAGS}")
+set(CMAKE_CXX_FLAGS "${warnCXXFLAGS} ${CMAKE_CXX_FLAGS} ${optCFLAGS}")
# Try to make Mac a bit more complient to open source standards
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
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";
+ }
}
}