src/xbt/backtrace_dummy.c
src/xbt/setset_private.h
src/xbt/automatonparse_promela.c
- src/xbt/mmalloc/attach.c
- src/xbt/mmalloc/detach.c
- src/xbt/mmalloc/keys.c
- src/xbt/mmalloc/mcalloc.c
src/xbt/mmalloc/mfree.c
- src/xbt/mmalloc/mm_legacy.c
- src/xbt/mmalloc/mm.c
src/xbt/mmalloc/mmalloc.c
- src/xbt/mmalloc/mmap-sup.c
- src/xbt/mmalloc/mmcheck.c
- src/xbt/mmalloc/mmemalign.c
- src/xbt/mmalloc/mmprivate.h
- src/xbt/mmalloc/mmstats.c
- src/xbt/mmalloc/mmtrace.c
- src/xbt/mmalloc/mrealloc.c
- src/xbt/mmalloc/mvalloc.c
- src/xbt/mmalloc/sbrk-sup.c
+ src/xbt/mmalloc/mmalloc.info
+ src/xbt/mmalloc/mmalloc.texi
+ src/xbt/mmalloc/mm.c
+ src/xbt/mmalloc/mm_diff.c
+ src/xbt/mmalloc/mm_legacy.c
+ src/xbt/mmalloc/mm_module.c
+ src/xbt/mmalloc/mmorecore.c
+ src/xbt/mmalloc/mmprivate.h
+ src/xbt/mmalloc/mmtrace.awk
+ src/xbt/mmalloc/mrealloc.c
src/xbt/mmalloc/test/mmalloc_test.c
src/xbt/datadesc/ddt_parse.yy.l
src/xbt/datadesc/ddt_parse.yy.h
examples/gras/ping/ping.h
examples/gras/console/ping.h
examples/gras/mmrpc/mmrpc.h
+
+ examples/msg/mc/parserPromela.yacc
+ examples/msg/mc/parserPromela.lex
+ examples/msg/mc/automaton.h
+ examples/msg/mc/bugged1_liveness.h
+ examples/msg/mc/centralized_liveness.h
+ examples/msg/mc/automatonparse_promela.h
+ examples/msg/mc/bugged2_liveness.h
+ examples/msg/mc/y.tab.h
tools/gras/gras_stub_generator.h
tools/tesh/run_context.h
file(GLOB_RECURSE examples_to_install_in_doc
"examples/*.c"
"examples/*.h"
+"examples/*yacc"
+"examples/*lex"
"examples/*.cxx"
"examples/*.hpp"
"examples/*.rb"
"examples/*.xml"
"examples/*README"
)
-
-
set(DOC_SOURCES
doc/install.doc
DOXYGEN_NAVBAR_CHILD "Recapping part 1"=GRAS_tut_tour_message_recaping.html
DOXYGEN_NAVBAR_CHILD "12: Static data definition"=GRAS_tut_tour_staticstruct.html
DOXYGEN_NAVBAR_CHILD "13: Pointers definition"=GRAS_tut_tour_pointers.html
- DOXYGEN_NAVBAR_CHILD "14: Dynars definition"=GRAS_tut_tour_dynars.html
+ DOXYGEN_NAVBAR_CHILD "14: Dynars definition"=GRAS_tut_tour_dynar.html
DOXYGEN_NAVBAR_CHILD "15: Manual data definition"=GRAS_tut_tour_manualdatadef.html
DOXYGEN_NAVBAR_CHILD "16: Advanced data definition"=GRAS_tut_tour_exchangecb.html
--> \endhtmlonly
/**
* Finger element.
*/
-typedef struct finger {
+typedef struct s_finger {
int id;
char mailbox[MAILBOX_NAME_SIZE]; // string representation of the id
} s_finger_t, *finger_t;
/**
* Node data.
*/
-typedef struct node {
+typedef struct s_node {
int id; // my id
char mailbox[MAILBOX_NAME_SIZE]; // my mailbox name (string representation of the id)
s_finger_t *fingers; // finger table, of size nb_bits (fingers[0] is my successor)
/**
* Data attached with the tasks sent and received
*/
-typedef struct task_data {
+typedef struct s_task_data {
e_task_type_t type; // type of task
int request_id; // id paramater (used by some types of tasks)
int request_finger; // finger parameter (used by some types of tasks)
if (join_success) {
while (MSG_get_clock() < init_time + deadline
-// && MSG_get_clock() < node.last_change_date + 1000
- && MSG_get_clock() < max_simulation_time) {
+// && MSG_get_clock() < node.last_change_date + 1000
+ && MSG_get_clock() < max_simulation_time) {
if (node.comm_receive == NULL) {
task_received = NULL;
check_predecessor(&node);
next_check_predecessor_date = MSG_get_clock() + periodic_check_predecessor_delay;
}
- else if (MSG_get_clock() >= next_lookup_date) {
- random_lookup(&node);
- next_lookup_date = MSG_get_clock() + periodic_lookup_delay;
- }
+ else if (MSG_get_clock() >= next_lookup_date) {
+ random_lookup(&node);
+ next_lookup_date = MSG_get_clock() + periodic_lookup_delay;
+ }
else {
// nothing to do: sleep for a while
MSG_process_sleep(5);
task_data->answer_id = node->fingers[0].id;
XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d",
task_data->issuer_host_name,
- task_data->answer_to,
+ task_data->answer_to,
task_data->request_id, task_data->answer_id);
MSG_task_dsend(task, task_data->answer_to, task_free);
}
if (to == 1) { // notify my successor
to_mailbox = node->fingers[0].mailbox;
XBT_INFO("Telling my Successor %d about my departure via mailbox %s",
- node->fingers[0].id, to_mailbox);
+ node->fingers[0].id, to_mailbox);
req_data->type = TASK_PREDECESSOR_LEAVING;
}
else if (to == -1) { // notify my predecessor
to_mailbox = node->pred_mailbox;
XBT_INFO("Telling my Predecessor %d about my departure via mailbox %s",
- node->pred_id, to_mailbox);
+ node->pred_id, to_mailbox);
req_data->type = TASK_SUCCESSOR_LEAVING;
}
m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
XBT_DEBUG("Failed to receive the answer to my 'Find Successor' request (task %p): %d",
task_sent, (int)res);
stop = 1;
- MSG_comm_destroy(node->comm_receive);
- node->comm_receive = NULL;
+ MSG_comm_destroy(node->comm_receive);
+ node->comm_receive = NULL;
}
else {
m_task_t task_received = MSG_comm_get_task(node->comm_receive);
XBT_DEBUG("Received a task (%p)", task_received);
task_data_t ans_data = MSG_task_get_data(task_received);
- if (MC_IS_ENABLED) {
- MC_assert(task_received == task_sent);
- }
+ if (MC_IS_ENABLED) {
+ MC_assert(task_received == task_sent);
+ }
if (task_received != task_sent) {
// this is not the expected answer
- MSG_comm_destroy(node->comm_receive);
- node->comm_receive = NULL;
+ MSG_comm_destroy(node->comm_receive);
+ node->comm_receive = NULL;
handle_task(node, task_received);
}
else {
ans_data->request_id, task_received, id, ans_data->answer_id);
successor = ans_data->answer_id;
stop = 1;
- MSG_comm_destroy(node->comm_receive);
- node->comm_receive = NULL;
+ MSG_comm_destroy(node->comm_receive);
+ node->comm_receive = NULL;
task_free(task_received);
}
}
if (res != MSG_OK) {
XBT_DEBUG("Failed to receive the answer to my 'Get Predecessor' request (task %p): %d",
- task_sent, (int)res);
+ task_sent, (int)res);
stop = 1;
- MSG_comm_destroy(node->comm_receive);
- node->comm_receive = NULL;
+ MSG_comm_destroy(node->comm_receive);
+ node->comm_receive = NULL;
}
else {
m_task_t task_received = MSG_comm_get_task(node->comm_receive);
task_data_t ans_data = MSG_task_get_data(task_received);
- if (MC_IS_ENABLED) {
- MC_assert(task_received == task_sent);
- }
+ if (MC_IS_ENABLED) {
+ MC_assert(task_received == task_sent);
+ }
if (task_received != task_sent) {
- MSG_comm_destroy(node->comm_receive);
- node->comm_receive = NULL;
+ MSG_comm_destroy(node->comm_receive);
+ node->comm_receive = NULL;
handle_task(node, task_received);
}
else {
task_received, ask_to, ans_data->answer_id);
predecessor_id = ans_data->answer_id;
stop = 1;
- MSG_comm_destroy(node->comm_receive);
- node->comm_receive = NULL;
+ MSG_comm_destroy(node->comm_receive);
+ node->comm_receive = NULL;
task_free(task_received);
}
}
length = strlen("-timeout=");
if (!strncmp(options[0], "-timeout=", length) && strlen(options[0]) > length) {
- timeout = atoi(options[0] + length);
- XBT_DEBUG("Set timeout to %d", timeout);
+ timeout = atoi(options[0] + length);
+ XBT_DEBUG("Set timeout to %d", timeout);
}
else {
- xbt_die("Invalid chord option '%s'", options[0]);
+ xbt_die("Invalid chord option '%s'", options[0]);
}
}
options++;
add_executable(bugged2 bugged2.c)
add_executable(bugged3 bugged3.c)
add_executable(random_test random_test.c)
-add_executable(bugged1_liveness automaton.c automatonparse_promela.c bugged1_liveness.c)
+add_executable(bugged1_for_liveness automaton.c automatonparse_promela.c bugged1_for_liveness.c)
+add_executable(bugged1_while_liveness automaton.c automatonparse_promela.c bugged1_while_liveness.c)
add_executable(bugged2_liveness automaton.c automatonparse_promela.c bugged2_liveness.c)
add_executable(centralized_liveness automaton.c automatonparse_promela.c centralized_liveness.c)
-
-
+add_executable(test_snapshot automaton.c automatonparse_promela.c test_snapshot.c)
target_link_libraries(centralized simgrid m )
target_link_libraries(bugged1 simgrid m )
target_link_libraries(bugged2 simgrid m )
target_link_libraries(bugged3 simgrid m )
target_link_libraries(random_test simgrid m )
-target_link_libraries(bugged1_liveness simgrid m )
+target_link_libraries(bugged1_for_liveness simgrid m )
+target_link_libraries(bugged1_while_liveness simgrid m )
target_link_libraries(bugged2_liveness simgrid m )
-target_link_libraries(centralized_liveness simgrid m )
\ No newline at end of file
+target_link_libraries(centralized_liveness simgrid m )
+target_link_libraries(test_snapshot simgrid m )
/***************** Centralized Mutual Exclusion Algorithm *********************/
/* This example implements a centralized mutual exclusion algorithm. */
-/* CS requests of client 2 not satisfied */
+/* CS requests of client 1 not satisfied */
/* LTL property checked : G(r->F(cs)); (r=request of CS, cs=CS ok) */
/******************************************************************************/
#include "y.tab.c"
#define AMOUNT_OF_CLIENTS 2
-#define CS_PER_PROCESS 1
+#define CS_PER_PROCESS 2
-XBT_LOG_NEW_DEFAULT_CATEGORY(example_liveness_with_cycle, "my log messages");
+XBT_LOG_NEW_DEFAULT_CATEGORY(bugged1_liveness, "my log messages");
int r=0;
XBT_INFO("CS already used. Queue the request of client %d", atoi(req) +1);
xbt_dynar_push(requests, &req);
} else { // can serve it immediatly
- if(strcmp(req, "1") == 0){
+ if(strcmp(req, "2") == 0){
m_task_t answer = MSG_task_create("grant", 0, 1000, NULL);
MSG_task_send(answer, req);
CS_used = 1;
XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests));
char *req ;
xbt_dynar_get_cpy(requests, (xbt_dynar_length(requests) - 1), &req);
- if(strcmp(req, "1") == 0){
+ if(strcmp(req, "2") == 0){
xbt_dynar_pop(requests, &req);
MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req);
todo--;
char *my_mailbox = bprintf("%s", argv[1]);
int i;
- // request the CS 4 times, sleeping a bit in between
+ // request the CS (CS_PER_PROCESS times), sleeping a bit in between
for (i = 0; i < CS_PER_PROCESS; i++) {
XBT_INFO("Ask the request");
MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator");
- if(strcmp(my_mailbox, "2") == 0){
+ if(strcmp(my_mailbox, "1") == 0){
r = 1;
cs = 0;
XBT_DEBUG("Propositions changed : r=1, cs=0");
MSG_task_receive(&grant, my_mailbox);
const char *kind = MSG_task_get_name(grant);
- if((strcmp(my_mailbox, "2") == 0) && (strcmp("grant", kind) == 0)){
+ if((strcmp(my_mailbox, "1") == 0) && (strcmp("grant", kind) == 0)){
cs = 1;
r = 0;
XBT_DEBUG("Propositions changed : r=0, cs=1");
MSG_process_sleep(my_pid);
- if(strcmp(my_mailbox, "2") == 0){
+ if(strcmp(my_mailbox, "1") == 0){
cs=0;
r=0;
XBT_DEBUG("Propositions changed : r=0, cs=0");
--- /dev/null
+/***************** Centralized Mutual Exclusion Algorithm *********************/
+/* This example implements a centralized mutual exclusion algorithm. */
+/* CS requests of client 1 not satisfied */
+/* LTL property checked : G(r->F(cs)); (r=request of CS, cs=CS ok) */
+/******************************************************************************/
+
+#include "msg/msg.h"
+#include "mc/mc.h"
+#include "xbt/automaton.h"
+#include "xbt/automatonparse_promela.h"
+#include "bugged1_liveness.h"
+#include "y.tab.c"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(bugged1_liveness, "my log messages");
+
+int r=0;
+int cs=0;
+
+int predR(){
+ return r;
+}
+
+int predCS(){
+ return cs;
+}
+
+
+int coordinator(int argc, char *argv[])
+{
+ xbt_dynar_t requests = xbt_dynar_new(sizeof(char *), NULL); // dynamic vector storing requests (which are char*)
+ int CS_used = 0; // initially the CS is idle
+ while (1) {
+ m_task_t task = NULL;
+ MSG_task_receive(&task, "coordinator");
+ const char *kind = MSG_task_get_name(task); //is it a request or a release?
+ if (!strcmp(kind, "request")) { // that's a request
+ char *req = MSG_task_get_data(task);
+ if (CS_used) { // need to push the request in the vector
+ XBT_INFO("CS already used. Queue the request of client %d", atoi(req) +1);
+ xbt_dynar_push(requests, &req);
+ } else { // can serve it immediatly
+ if(strcmp(req, "2") == 0){
+ m_task_t answer = MSG_task_create("grant", 0, 1000, NULL);
+ MSG_task_send(answer, req);
+ CS_used = 1;
+ XBT_INFO("CS idle. Grant immediatly");
+ }
+ }
+ } else { // that's a release. Check if someone was waiting for the lock
+ if (xbt_dynar_length(requests) > 0) {
+ XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests));
+ char *req ;
+ xbt_dynar_get_cpy(requests, (xbt_dynar_length(requests) - 1), &req);
+ if(strcmp(req, "2") == 0){
+ xbt_dynar_pop(requests, &req);
+ MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req);
+ }else{
+ xbt_dynar_pop(requests, &req);
+ MSG_task_send(MSG_task_create("notgrant", 0, 1000, NULL), req);
+ CS_used = 0;
+ }
+ } else { // nobody wants it
+ XBT_INFO("CS release. resource now idle");
+ CS_used = 0;
+ }
+ }
+ MSG_task_destroy(task);
+ }
+
+ return 0;
+}
+
+int client(int argc, char *argv[])
+{
+ int my_pid = MSG_process_get_PID(MSG_process_self());
+
+ char *my_mailbox = bprintf("%s", argv[1]);
+
+ // request the CS, sleeping a bit in between
+ while(1) {
+
+ XBT_INFO("Ask the request");
+ MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator");
+
+ if(strcmp(my_mailbox, "1") == 0){
+ r = 1;
+ cs = 0;
+ XBT_DEBUG("Propositions changed : r=1, cs=0");
+ }
+
+ // wait the answer
+ m_task_t grant = NULL;
+ MSG_task_receive(&grant, my_mailbox);
+ const char *kind = MSG_task_get_name(grant);
+
+ if((strcmp(my_mailbox, "1") == 0) && (strcmp("grant", kind) == 0)){
+ cs = 1;
+ r = 0;
+ XBT_DEBUG("Propositions changed : r=0, cs=1");
+ }
+
+
+ MSG_task_destroy(grant);
+ XBT_INFO("%s got the answer. Sleep a bit and release it", argv[1]);
+ MSG_process_sleep(1);
+ MSG_task_send(MSG_task_create("release", 0, 1000, NULL), "coordinator");
+
+ MSG_process_sleep(my_pid);
+
+ if(strcmp(my_mailbox, "1") == 0){
+ cs=0;
+ r=0;
+ XBT_DEBUG("Propositions changed : r=0, cs=0");
+ }
+
+ }
+
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ init();
+ yyparse();
+ automaton = get_automaton();
+ xbt_new_propositional_symbol(automaton,"r", &predR);
+ xbt_new_propositional_symbol(automaton,"cs", &predCS);
+
+ MSG_global_init(&argc, argv);
+ MSG_create_environment("../msg_platform.xml");
+ MSG_function_register("coordinator", coordinator);
+ MSG_function_register("client", client);
+ MSG_launch_application("deploy_bugged1_liveness.xml");
+ MSG_main_liveness(automaton, argv[0]);
+
+ return 0;
+}
#include "bugged2_liveness.h"
#include "y.tab.c"
-XBT_LOG_NEW_DEFAULT_CATEGORY(example_liveness_with_cycle, "my log messages");
+XBT_LOG_NEW_DEFAULT_CATEGORY(bugged2_liveness, "my log messages");
char* buffer;
const char *mess = "message";
pready = 1;
+ XBT_INFO("pready = 1");
/* CS request */
XBT_INFO("Producer ask the request");
buffer = strdup(mess);
produce = 1;
+ XBT_INFO("produce = 1");
/* CS release */
MSG_task_send(MSG_task_create("release", 0, 1000, my_mailbox), "coordinator");
produce = 0;
pready = 0;
+ XBT_INFO("pready et produce = 0");
+
}
return 0;
MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator");
cready = 1;
+ XBT_INFO("cready = 1");
/* Wait the answer */
m_task_t grant = NULL;
mess = strdup(buffer);
buffer[0] = '\0';
- /* Display message */
+ /* Display message */
XBT_INFO("Message : %s", mess);
- if(strcmp(mess, "") != 0)
+ if(strcmp(mess, "") != 0){
consume = 1;
+ XBT_INFO("consume = 1");
+ }
/* CS release */
MSG_task_send(MSG_task_create("release", 0, 1000, my_mailbox), "coordinator");
consume = 0;
cready = 0;
+ XBT_INFO("cready et consume = 0");
+
}
return 0;
--- /dev/null
+#include "msg/msg.h"
+#include "mc/mc.h"
+#include "xbt/automaton.h"
+#include "xbt/automatonparse_promela.h"
+#include "test_snapshot.h"
+#include "y.tab.c"
+#include <stdlib.h>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(test_snapshot, "my log messages");
+
+int r=0;
+int cs=0;
+
+int i = 1;
+xbt_dynar_t d1 = NULL;
+xbt_dynar_t d2 = NULL;
+char *c1;
+
+int predR(){
+ return r;
+}
+
+int predCS(){
+ return cs;
+}
+
+void check(){
+ XBT_INFO("*** Check ***");
+ if(d1!=NULL){
+ XBT_INFO("Dynar d1 (%p -> %p) length : %lu", &d1, d1, xbt_dynar_length(d1));
+ unsigned int cursor = 0;
+ char *elem;
+ xbt_dynar_foreach(d1, cursor, elem){
+ XBT_INFO("Elem in dynar d1 : %s", elem);
+ }
+ }else{
+ XBT_INFO("Dynar d1 NULL");
+ }
+ if(d2!=NULL){
+ XBT_INFO("Dynar d2 (%p -> %p) length : %lu", &d2, d2, xbt_dynar_length(d2));
+ unsigned int cursor = 0;
+ char *elem;
+ xbt_dynar_foreach(d2, cursor, elem){
+ XBT_INFO("Elem in dynar d2 : %s", elem);
+ }
+ }else{
+ XBT_INFO("Dynar d2 NULL");
+ }
+}
+
+
+int coordinator(int argc, char *argv[])
+{
+
+ while(i>0){
+
+ m_task_t task = NULL;
+ MSG_task_receive(&task, "coordinator");
+ const char *kind = MSG_task_get_name(task);
+
+ //check();
+
+ if (!strcmp(kind, "request")) {
+ char *req = MSG_task_get_data(task);
+ m_task_t answer = MSG_task_create("received", 0, 1000, NULL);
+ MSG_task_send(answer, req);
+ }else{
+ XBT_INFO("End of coordinator");
+ }
+
+ }
+
+ return 0;
+}
+
+int client(int argc, char *argv[])
+{
+ int my_pid = MSG_process_get_PID(MSG_process_self());
+
+ char *my_mailbox = bprintf("%s", argv[1]);
+
+ while(i>0){
+
+ XBT_INFO("Ask the request");
+ MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator");
+
+ r = 1;
+
+ check();
+
+ // wait the answer
+ m_task_t task = NULL;
+ MSG_task_receive(&task, my_mailbox);
+ MSG_task_destroy(task);
+
+ check();
+
+ XBT_INFO("*** Update ***");
+ xbt_dynar_reset(d1);
+ free(c1);
+ xbt_dynar_free(&d1);
+ d2 = xbt_dynar_new(sizeof(char *), NULL);
+ XBT_INFO("Dynar d2 : %p -> %p", &d2, d2);
+ char *c2 = strdup("boooooooo");
+ xbt_dynar_push(d2, &c2);
+
+ cs = 1;
+
+ check();
+
+ MSG_process_sleep(1);
+ MSG_task_send(MSG_task_create("release", 0, 1000, NULL), "coordinator");
+
+ check();
+
+ MSG_process_sleep(my_pid);
+
+ i--;
+ }
+
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+
+ d1 = xbt_dynar_new(sizeof(char *), NULL);
+ XBT_DEBUG("Dynar d1 : %p -> %p", &d1, d1);
+ c1 = strdup("coucou");
+ xbt_dynar_push(d1, &c1);
+ xbt_dynar_push(d1, &c1);
+
+ init();
+ yyparse();
+ automaton = get_automaton();
+ xbt_new_propositional_symbol(automaton,"r", &predR);
+ xbt_new_propositional_symbol(automaton,"cs", &predCS);
+
+ MSG_global_init(&argc, argv);
+ MSG_create_environment("../msg_platform.xml");
+ MSG_function_register("coordinator", coordinator);
+ MSG_function_register("client", client);
+ MSG_launch_application("deploy_test_snapshot.xml");
+ MSG_main_liveness(automaton, argv[0]);
+
+ return 0;
+}
--- /dev/null
+#ifndef _TEST_SNAPSHOT_H
+#define _TEST_SNAPSHOT_H
+
+int yyparse(void);
+int yywrap(void);
+int yylex(void);
+
+int predCS(void);
+int predR(void);
+
+int coordinator(int argc, char *argv[]);
+int client(int argc, char *argv[]);
+
+void check(void);
+
+#endif
* * testname: if given, the test on which the directive acts. If not, acts on any tests.
*/
-XBT_PUBLIC(int) xbt_test_run(char *selection);
+XBT_PUBLIC(int) xbt_test_run(char *selection, int verbosity);
/* Show information about the selection of tests */
XBT_PUBLIC(void) xbt_test_dump(char *selection);
/* Cleanup the mess */
unsigned int dynar_cursor;
char *key;
AS_t elem;
- network_element_t network_elem;
+ sg_routing_edge_t network_elem;
if(xbt_dict_is_empty(current_comp->routing_sons)) {
// I am no AS
xbt_assert(fp,
"Cannot open /proc/self/maps to investigate the memory map of the process. Please report this bug.");
- //XBT_DEBUG("/proc/self/maps");
-
ret = xbt_new0(s_memory_map_t, 1);
/* Read one line at the time, parse it and add it to the memory map to be returned */
while ((read = getline(&line, &n, fp)) != -1) {
- XBT_DEBUG("%s", line);
+ //fprintf(stderr,"%s", line);
/* Wipeout the new line character */
line[read - 1] = '\0';
typedef struct s_smx_stat {
s_file_stat_t surf_stat;
-} s_smx_stat_t, *smx_stat_t;
+} s_smx_stat_t;
/*********************************** Time ************************************/
xbt_die("Impossible to initialize GTNetS interface");
}
- routing_model_create(sizeof(network_link_GTNETS_t), NULL);
+ routing_model_create(NULL);
}
#ifdef HAVE_LATENCY_BOUND_TRACKING
xbt_die("Impossible to initialize NS3 interface");
}
- routing_model_create(sizeof(s_surf_ns3_link_t), NULL);
+ routing_model_create(NULL);
define_callbacks_ns3();
NS3_HOST_LEVEL = xbt_lib_add_level(host_lib,(void_f_pvoid_t)free_ns3_host);
s_surf_action_t generic_action;
#ifdef HAVE_TRACING
double last_sent;
- network_element_t src_elm;
- network_element_t dst_elm;
+ sg_routing_edge_t src_elm;
+ sg_routing_edge_t dst_elm;
#endif //HAVE_TRACING
} s_surf_action_network_ns3_t, *surf_action_network_ns3_t;
typedef struct surf_stat { /* file status structure */
s_file_stat_t stat;
/* possible additionnal fields (e.g., popularity, last access time to know whether the file is in cache, ...) */
-} s_surf_stat_t, *surf_stat_t;
+} s_surf_stat_t;
typedef struct surf_file {
char *name;
route_t e_route = (route_t) e;
if (e_route) {
xbt_dynar_free(&(e_route->link_list));
- xbt_free(e_route->src_gateway);
- xbt_free(e_route->dst_gateway);
xbt_free(e_route);
}
}
}
/* run test one suite */
-static int xbt_test_suite_run(xbt_test_suite_t suite)
+static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
{
xbt_test_unit_t unit;
xbt_test_test_t test;
/* Display whether this unit went well */
- if (unit->test_failed > 0 || unit->test_expect) {
+ if (unit->test_failed > 0 || unit->test_expect ||
+ (verbosity && unit->nb_tests > 0)) {
/* some tests failed (or were supposed to), so do detailed reporting of test case */
if (unit->test_failed > 0) {
fprintf(stderr, ".. failed\n");
}
}
-int xbt_test_run(char *selection)
+int xbt_test_run(char *selection, int verbosity)
{
apply_selection(selection);
/* Run all the suites */
xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
- xbt_test_suite_run(suite);
+ xbt_test_suite_run(suite, verbosity);
/* Display some more statistics */
fprintf(stderr, "\n\n TOTAL: Suites: %.0f%% ok (%d suites: ",
void_f_pvoid_t edge_free_function,
void_f_pvoid_t graph_free_function)
{
- unsigned int cursor = 0;
- xbt_node_t node = NULL;
- xbt_edge_t edge = NULL;
+ unsigned int cursor;
+ xbt_node_t node;
+ xbt_edge_t edge;
+ xbt_dynar_foreach(g->edges, cursor, edge) {
+ if (edge_free_function)
+ edge_free_function(edge->data);
+ free(edge);
+ }
+ xbt_dynar_free(&(g->edges));
xbt_dynar_foreach(g->nodes, cursor, node) {
xbt_dynar_free(&(node->out));
xbt_dynar_free(&(node->in));
if (node_free_function)
node_free_function(node->data);
+ free(node);
}
-
- xbt_dynar_foreach(g->edges, cursor, edge) {
- if (edge_free_function)
- edge_free_function(edge->data);
- }
-
- xbt_dynar_foreach(g->nodes, cursor, node)
- free(node);
xbt_dynar_free(&(g->nodes));
- xbt_dynar_foreach(g->edges, cursor, edge)
- free(edge);
- xbt_dynar_free(&(g->edges));
if (graph_free_function)
graph_free_function(g->data);
free(g);
xbt_graph_parse_lex_destroy();
- return;
}
int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2){
if(mdp1 == NULL && mdp2 == NULL){
- XBT_DEBUG("Malloc descriptors null\n");
+ fprintf(stderr, "Malloc descriptors null\n");
return 0;
}
if(mdp1->heapsize != mdp2->heapsize){
fprintf(stderr,"Different number of info entries\n");
return 1;
- }
-
+ }
if(mdp1->heapbase != mdp2->heapbase){
fprintf(stderr,"Different first block of the heap\n");
return 1;
}
-
if(mdp1->heapindex != mdp2->heapindex){
fprintf(stderr,"Different index for the heap table : %zu - %zu\n", mdp1->heapindex, mdp2->heapindex);
return 1;
}
-
if(mdp1->base != mdp2->base){
fprintf(stderr,"Different base address of the memory region\n");
return 1;
int k;
int distance = 0;
+ int pointer_align;
/* Check busy blocks*/
}
if(memcmp(addr_block1, addr_block2, (mdp1->heapinfo[i].busy_block.busy_size)) != 0){
- fprintf(stderr,"Different data in large block %zu (size = %zu (in blocks), busy_size = %zu (in bytes))\n", i, mdp1->heapinfo[i].busy_block.size, mdp1->heapinfo[i].busy_block.busy_size);
+ fprintf(stderr,"\nDifferent data in large block %zu (size = %zu (in blocks), busy_size = %zu (in bytes))\n", i, mdp1->heapinfo[i].busy_block.size, mdp1->heapinfo[i].busy_block.busy_size);
/* Hamming distance on different blocks */
distance = 0;
for(k=0;k<mdp1->heapinfo[i].busy_block.busy_size;k++){
- if(memcmp(((char *)addr_block1) + k, ((char *)addr_block2) + k, 1) != 0)
+ if(memcmp(((char *)addr_block1) + k, ((char *)addr_block2) + k, 1) != 0){
+ fprintf(stderr, "Different byte (offset=%d) (%p - %p) in block %zu\n", k, (char *)addr_block1 + k, (char *)addr_block2 + k, i);
distance++;
+ pointer_align = (k / sizeof(void*)) * sizeof(void*);
+ fprintf(stderr, "Pointer address : %p - %p\n", *((void **)((char *)addr_block1 + pointer_align)), *((void **)((char *)addr_block2 + pointer_align)));
+ }
}
fprintf(stderr, "Hamming distance between blocks : %d\n", distance);
addr_frag1 = (char *)addr_block1 + (j * frag_size);
addr_frag2 = (char *)addr_block2 + (j * frag_size);
+
if(memcmp(addr_frag1, addr_frag2, mdp1->heapinfo[i].busy_frag.frag_size[j]) != 0){
- fprintf(stderr,"Different data in fragment %zu (size = %zu, size used = %hu) in block %zu \n", j, frag_size, mdp1->heapinfo[i].busy_frag.frag_size[j], i);
+ fprintf(stderr,"\nDifferent data in fragment %zu (size = %zu, size used = %hu) in block %zu \n", j, frag_size, mdp1->heapinfo[i].busy_frag.frag_size[j], i);
/* Hamming distance on different blocks */
distance = 0;
for(k=0;k<mdp1->heapinfo[i].busy_frag.frag_size[j];k++){
- if(memcmp(((char *)addr_frag1) + k, ((char *)addr_frag2) + k, 1) != 0)
+ if(memcmp(((char *)addr_frag1) + k, ((char *)addr_frag2) + k, 1) != 0){
+ fprintf(stderr, "Different byte (offset=%d) (%p - %p) in fragment %zu in block %zu\n", k, (char *)addr_frag1 + k, (char *)addr_frag2 + k, j, i);
distance++;
+ pointer_align = (k / sizeof(void*)) * sizeof(void*);
+ fprintf(stderr, "Pointer address : %p - %p\n", *((void **)((char *)addr_frag1 + pointer_align)), *((void **)((char *)addr_frag2 + pointer_align)));
+ }
}
fprintf(stderr, "Hamming distance between fragments : %d\n", distance);
/*
* Diff related functions
+ *
+ * Implementation of the algorithm described in "An O(NP) Sequence Comparison
+ * Algorithm", by Sun Wu, Udi Manber, Gene Myers, and Webb Miller (Information
+ * Processing Letters 35(6):317-323, 1990), with the linear-space
+ * divide-and-conquer strategy described in "An O(ND) Difference Algorithm and
+ * Its Variations", by Eugene W. Myers (Algorithmica 1:251-266, 1986).
*/
-static XBT_INLINE void diff_push(xbt_dynar_t dyn, char prefix, const char *s)
-{
- char *topush = bprintf("%c %s", prefix, s);
- xbt_dynar_push(dyn, &topush);
-}
-static int diff_member(const char *s, xbt_dynar_t d, unsigned from, unsigned to)
+struct subsequence {
+ int x, y; /* starting coordinates */
+ int len; /* length */
+};
+
+static XBT_INLINE
+void diff_snake(const char *vec_a[], int a0, int len_a,
+ const char *vec_b[], int b0, int len_b,
+ struct subsequence *seqs, int *fp, int k, int limit)
{
- unsigned i;
- for (i = from; i < to; i++)
- if (!strcmp(s, xbt_dynar_get_as(d, i, char *)))
- return 1;
- return 0;
+ int record_seq;
+ int x, y;
+ int fp_left = fp[k - 1] + 1;
+ int fp_right = fp[k + 1];
+ if (fp_left > fp_right) {
+ x = fp_left;
+ record_seq = k - 1;
+ } else {
+ x = fp_right;
+ record_seq = k + 1;
+ }
+ y = x - k;
+ if (x + y <= limit) {
+ seqs[k].x = x;
+ seqs[k].y = y;
+ record_seq = k;
+ } else {
+ seqs[k] = seqs[record_seq];
+ }
+ while (x < len_a && y < len_b && !strcmp(vec_a[a0 + x], vec_b[b0 + y]))
+ ++x, ++y;
+ fp[k] = x;
+ if (record_seq == k)
+ seqs[k].len = x - seqs[k].x;
}
-static void diff_easy_prefix(xbt_dynar_t res, xbt_dynar_t da, xbt_dynar_t db)
+/* Returns the length of a shortest edit script, and a common
+ * subsequence from the middle.
+ */
+static int diff_middle_subsequence(const char *vec_a[], int a0, int len_a,
+ const char *vec_b[], int b0, int len_b,
+ struct subsequence *subseq,
+ struct subsequence *seqs, int *fp)
{
- while (xbt_dynar_length(da) > 0 && xbt_dynar_length(db) > 0) {
- char *sa = xbt_dynar_getfirst_as(da, char *);
- char *sb = xbt_dynar_getfirst_as(db, char *);
-
- if (!strcmp(sa, sb)) {
- /* sa == sb */
- diff_push(res, ' ', sa);
- xbt_dynar_shift(da, NULL);
- xbt_dynar_shift(db, NULL);
- } else if (!diff_member(sa, db, 1, xbt_dynar_length(db))) {
- /* sa not in db */
- diff_push(res, '-', sa);
- xbt_dynar_shift(da, NULL);
- } else if (!diff_member(sb, da, 1, xbt_dynar_length(da))) {
- /* sb not in da */
- diff_push(res, '+', sb);
- xbt_dynar_shift(db, NULL);
- } else {
- /* sa in db, and sb in da: cannot go further */
- return;
- }
+ const int delta = len_a - len_b;
+ const int limit = (len_a + len_b) / 2;
+ int kmin;
+ int kmax;
+ int k;
+ int p = -1;
+
+ if (delta >= 0) {
+ kmin = 0;
+ kmax = delta;
+ } else {
+ kmin = delta;
+ kmax = 0;
}
+ for (k = kmin; k <= kmax; k++)
+ fp[k] = -1;
+ do {
+ p++;
+ fp[kmin - p - 1] = fp[kmax + p + 1] = -1;
+ for (k = kmax + p; k > delta; k--)
+ diff_snake(vec_a, a0, len_a, vec_b, b0, len_b, seqs, fp, k, limit);
+ for (k = kmin - p; k <= delta; k++)
+ diff_snake(vec_a, a0, len_a, vec_b, b0, len_b, seqs, fp, k, limit);
+ } while (fp[delta] != len_a);
+
+ subseq->x = a0 + seqs[delta].x;
+ subseq->y = b0 + seqs[delta].y;
+ subseq->len = seqs[delta].len;
+ return abs(delta) + 2 * p;;
}
-static void diff_easy_suffix(xbt_dynar_t res, xbt_dynar_t da, xbt_dynar_t db)
+/* Finds a longest common subsequence.
+ * Returns its length.
+ */
+static int diff_compute_lcs(const char *vec_a[], int a0, int len_a,
+ const char *vec_b[], int b0, int len_b,
+ xbt_dynar_t common_sequence,
+ struct subsequence *seqs, int *fp)
{
- while (xbt_dynar_length(da) > 0 && xbt_dynar_length(db) > 0) {
- char *sa = xbt_dynar_getlast_as(da, char *);
- char *sb = xbt_dynar_getlast_as(db, char *);
-
- if (!strcmp(sa, sb)) {
- /* sa == sb */
- diff_push(res, ' ', sa);
- xbt_dynar_pop(da, NULL);
- xbt_dynar_pop(db, NULL);
- } else if (!diff_member(sb, da, 0, xbt_dynar_length(da) - 1)) {
- /* sb not in da */
- diff_push(res, '+', sb);
- xbt_dynar_pop(db, NULL);
- } else if (!diff_member(sa, db, 0, xbt_dynar_length(db) - 1)) {
- /* sa not in db */
- diff_push(res, '-', sa);
- xbt_dynar_pop(da, NULL);
+ if (len_a > 0 && len_b > 0) {
+ struct subsequence subseq;
+ int ses_len = diff_middle_subsequence(vec_a, a0, len_a, vec_b, b0, len_b,
+ &subseq, seqs, fp);
+ int lcs_len = (len_a + len_b - ses_len) / 2;
+ if (lcs_len == 0) {
+ return 0;
+ } else if (ses_len > 1) {
+ int lcs_len1 = subseq.len;
+ if (lcs_len1 < lcs_len)
+ lcs_len1 += diff_compute_lcs(vec_a, a0, subseq.x - a0,
+ vec_b, b0, subseq.y - b0,
+ common_sequence, seqs, fp);
+ if (subseq.len > 0)
+ xbt_dynar_push(common_sequence, &subseq);
+ if (lcs_len1 < lcs_len) {
+ int u = subseq.x + subseq.len;
+ int v = subseq.y + subseq.len;
+ diff_compute_lcs(vec_a, u, a0 + len_a - u, vec_b, v, b0 + len_b - v,
+ common_sequence, seqs, fp);
+ }
} else {
- /* sa in db, and sb in da: cannot go further */
- return;
+ int len = MIN(len_a, len_b) - subseq.len;
+ if (subseq.x == a0 && subseq.y == b0) {
+ if (subseq.len > 0)
+ xbt_dynar_push(common_sequence, &subseq);
+ if (len > 0) {
+ struct subsequence subseq0 = {a0 + len_a - len,
+ b0 + len_b - len, len};
+ xbt_dynar_push(common_sequence, &subseq0);
+ }
+ } else {
+ if (len > 0) {
+ struct subsequence subseq0 = {a0, b0, len};
+ xbt_dynar_push(common_sequence, &subseq0);
+ }
+ if (subseq.len > 0)
+ xbt_dynar_push(common_sequence, &subseq);
+ }
}
+ return lcs_len;
+ } else {
+ return 0;
}
}
-static XBT_INLINE int diff_get(xbt_matrix_t C, int i, int j)
+static int diff_member(const char *s, const char *vec[], int from, int to)
{
- return (i == -1 || j == -1) ? 0 : xbt_matrix_get_as(C, i, j, int);
+ for ( ; from < to ; from++)
+ if (!strcmp(s, vec[from]))
+ return 1;
+ return 0;
}
-static xbt_matrix_t diff_build_LCS(xbt_dynar_t da, xbt_dynar_t db)
+/* Extract common prefix.
+ */
+static void diff_easy_prefix(const char *vec_a[], int *a0_p, int *len_a_p,
+ const char *vec_b[], int *b0_p, int *len_b_p,
+ xbt_dynar_t common_sequence)
{
- unsigned len_a = xbt_dynar_length(da);
- unsigned len_b = xbt_dynar_length(db);
- xbt_matrix_t C = xbt_matrix_new(len_a, len_b, sizeof(int), NULL);
- int i, j;
-
- /* Compute the LCS */
- /*
- function LCSLength(X[1..m], Y[1..n])
- C = array(0..m, 0..n)
- for i := 0..m
- C[i,0] = 0
- for j := 1..n
- C[0,j] = 0
- for i := 1..m
- for j := 1..n
- if X[i] = Y[j]
- C[i,j] := C[i-1,j-1] + 1
- else:
- C[i,j] := max(C[i,j-1], C[i-1,j])
- return C[m,n]
- */
- for (i = 0; i < len_a; i++)
- for (j = 0; j < len_b; j++) {
-
- if (!strcmp(xbt_dynar_get_as(da, i, char *),
- xbt_dynar_get_as(db, j, char *)))
- xbt_matrix_get_as(C, i, j, int) = diff_get(C, i - 1, j - 1) + 1;
- else
- xbt_matrix_get_as(C, i, j, int) = max(diff_get(C, i, j - 1),
- diff_get(C, i - 1, j));
+ int a0 = *a0_p;
+ int b0 = *b0_p;
+ int len_a = *len_a_p;
+ int len_b = *len_b_p;
+
+ while (len_a > 0 && len_b > 0) {
+ struct subsequence subseq = {a0, b0, 0};
+ while (len_a > 0 && len_b > 0 && !strcmp(vec_a[a0], vec_b[b0])) {
+ a0++, len_a--;
+ b0++, len_b--;
+ subseq.len++;
}
- return C;
+ if (subseq.len > 0)
+ xbt_dynar_push(common_sequence, &subseq);
+ if (len_a > 0 && len_b > 0 &&
+ !diff_member(vec_a[a0], vec_b, b0 + 1, b0 + len_b)) {
+ a0++, len_a--;
+ } else {
+ break;
+ }
+ }
+
+ *a0_p = a0;
+ *b0_p = b0;
+ *len_a_p = len_a;
+ *len_b_p = len_b;
}
-static void diff_build_diff(xbt_dynar_t res,
- xbt_matrix_t C,
- xbt_dynar_t da, xbt_dynar_t db, int i, int j)
+/* Extract common suffix.
+ */
+static void diff_easy_suffix(const char *vec_a[], int *a0_p, int *len_a_p,
+ const char *vec_b[], int *b0_p, int *len_b_p,
+ xbt_dynar_t common_suffix)
{
- /* Construct the diff
- function printDiff(C[0..m,0..n], X[1..m], Y[1..n], i, j)
- if i > 0 and j > 0 and X[i] = Y[j]
- printDiff(C, X, Y, i-1, j-1)
- print " " + X[i]
- else
- if j > 0 and (i = 0 or C[i,j-1] >= C[i-1,j])
- printDiff(C, X, Y, i, j-1)
- print "+ " + Y[j]
- else if i > 0 and (j = 0 or C[i,j-1] < C[i-1,j])
- printDiff(C, X, Y, i-1, j)
- print "- " + X[i]
- */
-
- if (i >= 0 && j >= 0 && !strcmp(xbt_dynar_get_as(da, i, char *),
- xbt_dynar_get_as(db, j, char *))) {
- diff_build_diff(res, C, da, db, i - 1, j - 1);
- diff_push(res, ' ', xbt_dynar_get_as(da, i, char *));
- } else if (j >= 0 &&
- (i == -1 || diff_get(C, i, j - 1) >= diff_get(C, i - 1, j))) {
- diff_build_diff(res, C, da, db, i, j - 1);
- diff_push(res, '+', xbt_dynar_get_as(db, j, char *));
- } else if (i >= 0 &&
- (j == -1 || diff_get(C, i, j - 1) < diff_get(C, i - 1, j))) {
- diff_build_diff(res, C, da, db, i - 1, j);
- diff_push(res, '-', xbt_dynar_get_as(da, i, char *));
+ int a0 = *a0_p;
+ int b0 = *b0_p;
+ int len_a = *len_a_p;
+ int len_b = *len_b_p;
+
+ while (len_a > 0 && len_b > 0){
+ struct subsequence subseq;
+ subseq.len = 0;
+ while (len_a > 0 && len_b > 0 &&
+ !strcmp(vec_a[a0 + len_a - 1], vec_b[b0 + len_b - 1])) {
+ len_a--;
+ len_b--;
+ subseq.len++;
+ }
+ if (subseq.len > 0) {
+ subseq.x = a0 + len_a;
+ subseq.y = b0 + len_b;
+ xbt_dynar_push(common_suffix, &subseq);
+ }
+ if (len_a > 0 && len_b > 0 &&
+ !diff_member(vec_b[b0 + len_b - 1], vec_a, a0, a0 + len_a - 1)) {
+ len_b--;
+ } else {
+ break;
+ }
}
+
+ *a0_p = a0;
+ *b0_p = b0;
+ *len_a_p = len_a;
+ *len_b_p = len_b;
}
/** @brief Compute the unified diff of two strings */
{
xbt_dynar_t da = xbt_str_split(a, "\n");
xbt_dynar_t db = xbt_str_split(b, "\n");
- xbt_matrix_t C;
+ xbt_dynar_t common_sequence, common_suffix;
+ size_t len;
+ const char **vec_a, **vec_b;
+ int a0, b0;
+ int len_a, len_b;
+ int max;
+ int *fp_base, *fp;
+ struct subsequence *seqs_base, *seqs;
+ struct subsequence subseq;
xbt_dynar_t diff;
- xbt_dynar_t diff2;
char *res;
- size_t len;
-
- diff = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
- diff2 = xbt_dynar_new(sizeof(char *), NULL);
+ int x, y;
+ unsigned s;
/* Clean empty lines at the end of da and db */
len = strlen(a);
if (len > 0 && b[len - 1] == '\n')
xbt_dynar_pop(db, NULL);
- /* Extract the easy suffix, do it before extracting the prefix,
- * as xbt_dynar_pop costs less than xbt_dynar_shift */
- diff_easy_suffix(diff2, da, db);
+ /* Various initializations */
+ /* Assume that dynar's content is contiguous */
+ a0 = 0;
+ len_a = xbt_dynar_length(da);
+ vec_a = len_a ? xbt_dynar_get_ptr(da, 0) : NULL;
+ b0 = 0;
+ len_b = xbt_dynar_length(db);
+ vec_b = len_b ? xbt_dynar_get_ptr(db, 0) : NULL;
+ max = MAX(len_a, len_b) + 1;
+ fp_base = xbt_new(int, 2 * max + 1);
+ fp = fp_base + max; /* indexes in [-max..max] */
+ seqs_base = xbt_new(struct subsequence, 2 * max + 1);
+ seqs = seqs_base + max; /* indexes in [-max..max] */
+ common_sequence = xbt_dynar_new(sizeof(struct subsequence), NULL);
+ common_suffix = xbt_dynar_new(sizeof(struct subsequence), NULL);
+
+ /* Add a sentinel a the end of the sequence */
+ subseq.x = len_a;
+ subseq.y = len_b;
+ subseq.len = 0;
+ xbt_dynar_push(common_suffix, &subseq);
+
+ /* Compute the Longest Common Subsequence */
+ diff_easy_prefix(vec_a, &a0, &len_a, vec_b, &b0, &len_b, common_sequence);
+ diff_easy_suffix(vec_a, &a0, &len_a, vec_b, &b0, &len_b, common_suffix);
+ diff_compute_lcs(vec_a, a0, len_a, vec_b, b0, len_b, common_sequence, seqs, fp);
+ while (!xbt_dynar_is_empty(common_suffix)) {
+ xbt_dynar_pop(common_suffix, &subseq);
+ xbt_dynar_push(common_sequence, &subseq);
+ }
- /* Extract the easy prefix */
- diff_easy_prefix(diff, da, db);
+ /* Build a Shortest Edit Script, and the final result */
+ diff = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
+ x = 0;
+ y = 0;
+ xbt_dynar_foreach(common_sequence, s, subseq) {
+ while (x < subseq.x) {
+ char *topush = bprintf("- %s", vec_a[x++]);
+ xbt_dynar_push_as(diff, char*, topush);
+ }
+ while (y < subseq.y) {
+ char *topush = bprintf("+ %s", vec_b[y++]);
+ xbt_dynar_push_as(diff, char*, topush);
+ }
+ while (x < subseq.x + subseq.len) {
+ char *topush = bprintf(" %s", vec_a[x++]);
+ xbt_dynar_push_as(diff, char*, topush);
+ y++;
+ }
+ }
+ res = xbt_str_join(diff, "\n");
- /* Compute the diff for the remaining */
- C = diff_build_LCS(da, db);
- diff_build_diff(diff, C, da, db,
- xbt_dynar_length(da) - 1, xbt_dynar_length(db) - 1);
- xbt_matrix_free(C);
+ xbt_free(fp_base);
+ xbt_free(seqs_base);
xbt_dynar_free(&db);
xbt_dynar_free(&da);
-
- /* Add the easy suffix, in reverse order */
- while (!xbt_dynar_is_empty(diff2)) {
- char *topush = xbt_dynar_pop_as(diff2, char *);
- xbt_dynar_push(diff, &topush);
- }
- xbt_dynar_free(&diff2);
-
- /* Build the final result */
- res = xbt_str_join(diff, "\n");
+ xbt_dynar_free(&common_sequence);
+ xbt_dynar_free(&common_suffix);
xbt_dynar_free(&diff);
return res;
# GRAS tutorial
map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro
tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals
- tour_logs tour_timers tour_exceptions tour_rpc);
+ tour_logs tour_timers tour_exceptions tour_simpledata tour_rpc tour_explicitwait
+ tour_message_recaping tour_staticstruct tour_pointers tour_dynar
+ tour_manualdatadef tour_exchangecb);
# GRAS examples
map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
|| $file =~ /^html\/modules.*/
|| $file =~ /^html\/annotated.*/
|| $file =~ /^html\/group__.*/
- || $file =~ /^html\/functions.*/)
+ || $file =~ /^html\/functions.*/
+ || $file =~ /^html\/GRAS_tut_tour_.*/)
{
$tmp_buff .= ' <div class="tabs_group_use">'."\n";
$tmp_buff .= ' <ul class="tablist">'."\n";
$tmp_buff =~ s/<li class="current">/<li>/g;
$tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
}
- if($file =~ /^html\/group__.*/)
+ if($file =~ /^html\/group__.*/
+ || $file =~ /^html\/GRAS_tut_tour_.*/)
{
$tmp_buff =~ s/<li><a href="modules.html">/<li class="current"><a href="modules.html">/g;
}
$tmp_buff =~ s/<li><a href="annotated.html">/<li class="current"><a href="annotated.html">/g;
}
-
print TO $tmp_buff;
next;
}
int main(int argc, char *argv[]) {
xbt_test_suite_t suite;
char selection[1024];
- int i;\n
- int res;\n
+ int verbosity = 0;
+ int i;
+ int res;
+
/* SGU: BEGIN SUITES DECLARATION */
/* SGU: END SUITES DECLARATION */
strcat(selection, \",\");
strcat(selection, p);
}
- } else if (!strncmp(argv[i],\"--dump-only\",strlen(\"--dump-only\"))||
- !strncmp(argv[i],\"--dump\", strlen(\"--dump\"))) {
+ } else if (!strcmp(argv[i], \"--verbose\")) {
+ verbosity++;
+ } else if (!strcmp(argv[i], \"--dump-only\")||
+ !strcmp(argv[i], \"--dump\")) {
xbt_test_dump(selection);
return 0;
- } else if (!strncmp(argv[i],\"--help\",strlen(\"--help\"))) {
+ } else if (!strcmp(argv[i], \"--help\")) {
printf(
"Usage: testall [--help] [--tests=selection] [--dump-only]\\n\\n"
"--help: display this help\\n"
+ "--verbose: print the name for each running test\\n"
"--dump-only: don't run the tests, but display some debuging info about the tests\\n"
"--tests=selection: Use argument to select which suites/units/tests to run\\n"
" --tests can be used more than once, and selection may be a comma\\n"
}
/* Got all my tests to do */
- res = xbt_test_run(selection);
+ res = xbt_test_run(selection, verbosity);
xbt_test_exit();
return res;
}