#! ./tesh
p Test the DAX loader on a small DAX instance

! output sort
$ $SG_TEST_EXENV ${bindir:=.}/daxload/sd_daxload --log=no_loc ${srcdir:=.}/../platforms/two_clusters.xml ${srcdir:=.}/daxload/smalldax.xml
> [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
> [0.000000] [sd_daxparse/WARNING] Ignore file o1 size redefinition from 1000000 to 304
> [0.000000] [sd_daxparse/WARNING] Ignore file o2 size redefinition from 1000000 to 304
> [0.000000] [test/INFO] ------------------- Display all tasks of the loaded DAG ---------------------------
> [0.000000] [sd_task/INFO] Displaying task root
> [0.000000] [sd_task/INFO]   - state: schedulable not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 0
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 0
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     root_i1_1@task1
> [0.000000] [sd_task/INFO]     root_i2_2@task2
> [0.000000] [sd_task/INFO] Displaying task 1@task1
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 42000000000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     root_i1_1@task1
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     3@task1
> [0.000000] [sd_task/INFO]     1@task1_o1_3@task1
> [0.000000] [sd_task/INFO] Displaying task 2@task2
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 42000000000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     root_i2_2@task2
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     3@task1
> [0.000000] [sd_task/INFO]     2@task2_o2_3@task1
> [0.000000] [sd_task/INFO] Displaying task 3@task1
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 42000000000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 4
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     2@task2
> [0.000000] [sd_task/INFO]     1@task1
> [0.000000] [sd_task/INFO]     2@task2_o2_3@task1
> [0.000000] [sd_task/INFO]     1@task1_o1_3@task1
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     3@task1_o3_end
> [0.000000] [sd_task/INFO] Displaying task root_i2_2@task2
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: end-to-end communication
> [0.000000] [sd_task/INFO]   - amount: 1000000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     root
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     2@task2
> [0.000000] [sd_task/INFO] Displaying task 1@task1_o1_3@task1
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: end-to-end communication
> [0.000000] [sd_task/INFO]   - amount: 1000000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     1@task1
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     3@task1
> [0.000000] [sd_task/INFO] Displaying task 2@task2_o2_3@task1
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: end-to-end communication
> [0.000000] [sd_task/INFO]   - amount: 1000000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     2@task2
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     3@task1
> [0.000000] [sd_task/INFO] Displaying task 3@task1_o3_end
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: end-to-end communication
> [0.000000] [sd_task/INFO]   - amount: 4167312
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     3@task1
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     end
> [0.000000] [sd_task/INFO] Displaying task root_i1_1@task1
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: end-to-end communication
> [0.000000] [sd_task/INFO]   - amount: 1000000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     root
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     1@task1
> [0.000000] [sd_task/INFO] Displaying task end
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 0
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     3@task1_o3_end
> [0.000000] [test/INFO] ------------------- Schedule tasks ---------------------------
> [0.000000] [test/INFO] ------------------- Run the schedule ---------------------------
> [84.068138] [test/INFO] ------------------- Produce the trace file---------------------------
> [84.068138] [test/INFO] Producing the trace of the run into smalldax.trace

$ cat ${srcdir:=.}/daxload/smalldax.trace
> [0.000000] node-0.acme.org compute 0.000000 # root
> [0.015600] node-1.acme.org compute 42000000000.000000 # 1@task1
> [0.016600] node-10.acme.org compute 42000000000.000000 # 2@task2
> [42.033200] node-11.acme.org compute 42000000000.000000 # 3@task1
> [0.000000] node-0.acme.org send node-10.acme.org 1000000.000000 # root_i2_2@task2
> [0.016600] node-10.acme.org recv node-0.acme.org 1000000.000000 # root_i2_2@task2
> [42.015600] node-1.acme.org send node-11.acme.org 1000000.000000 # 1@task1_o1_3@task1
> [42.033200] node-11.acme.org recv node-1.acme.org 1000000.000000 # 1@task1_o1_3@task1
> [42.016600] node-10.acme.org send node-11.acme.org 1000000.000000 # 2@task2_o2_3@task1
> [42.033200] node-11.acme.org recv node-10.acme.org 1000000.000000 # 2@task2_o2_3@task1
> [84.033200] node-11.acme.org send node-0.acme.org 4167312.000000 # 3@task1_o3_end
> [84.068138] node-0.acme.org recv node-11.acme.org 4167312.000000 # 3@task1_o3_end
> [0.000000] node-0.acme.org send node-1.acme.org 1000000.000000 # root_i1_1@task1
> [0.015600] node-1.acme.org recv node-0.acme.org 1000000.000000 # root_i1_1@task1
> [84.068138] node-0.acme.org compute 0.000000 # end

$ cmake -E remove -f ${srcdir:=.}/dax.dot ${srcdir:=.}/daxload/smalldax.trace

p Test the DAX loader with a DAX comprising a cycle.

! expect return 255
$ $SG_TEST_EXENV ${bindir:=.}/daxload/sd_daxload --log=no_loc ${srcdir:=.}/../platforms/two_clusters.xml ${srcdir:=.}/daxload/simple_dax_with_cycle.xml
> [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
> [0.000000] [sd_daxparse/WARNING] the task root is not marked
> [0.000000] [sd_daxparse/WARNING] the task 1@task1 is in a cycle
> [0.000000] [sd_daxparse/WARNING] the task 3@task3 is in a cycle
> [0.000000] [sd_daxparse/ERROR] The DAX described in simple_dax_with_cycle.xml is not a DAG. It contains a cycle.
> [0.000000] [test/ERROR] A problem occurred during DAX parsing (cycle or syntax). Do not continue this test
