#! ./tesh
p Test the loader of DAG written in the DOT format

$ $SG_TEST_EXENV ${bindir:=.}/dag-dotload/sd_dag-dotload --log=no_loc ${srcdir:=.}/../platforms/two_clusters.xml ${srcdir:=.}/dag-dotload/dag.dot
> [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
> [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]     0
> [0.000000] [sd_task/INFO]     root->5
> [0.000000] [sd_task/INFO] Displaying task 0
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000129
> [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]     0->1
> [0.000000] [sd_task/INFO] Displaying task 1
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000131
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     0->1
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     1->2
> [0.000000] [sd_task/INFO] Displaying task 2
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000121
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     1->2
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     2->3
> [0.000000] [sd_task/INFO] Displaying task 3
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000231
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     2->3
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     4
> [0.000000] [sd_task/INFO] Displaying task 4
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000005
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     3
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     4->5
> [0.000000] [sd_task/INFO] Displaying task 5
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000046
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 2
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     4->5
> [0.000000] [sd_task/INFO]     root->5
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     6
> [0.000000] [sd_task/INFO] Displaying task 6
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000092
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     5
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     6->7
> [0.000000] [sd_task/INFO] Displaying task 7
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000041
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     6->7
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     7->8
> [0.000000] [sd_task/INFO]     7->end
> [0.000000] [sd_task/INFO] Displaying task 8
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000250
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     7->8
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     9
> [0.000000] [sd_task/INFO] Displaying task 9
> [0.000000] [sd_task/INFO]   - state: not scheduled not runnable
> [0.000000] [sd_task/INFO]   - kind: sequential computation
> [0.000000] [sd_task/INFO]   - amount: 10000000079
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     8
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     end
> [0.000000] [sd_task/INFO] Displaying task 0->1
> [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: 10001
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     0
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     1
> [0.000000] [sd_task/INFO] Displaying task 1->2
> [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: 10004
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     1
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     2
> [0.000000] [sd_task/INFO] Displaying task 2->3
> [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: 10002
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     2
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     3
> [0.000000] [sd_task/INFO] Displaying task 4->5
> [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: 10029
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     4
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     5
> [0.000000] [sd_task/INFO] Displaying task 6->7
> [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: 10005
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     6
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     7
> [0.000000] [sd_task/INFO] Displaying task 7->8
> [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: 10000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     7
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     8
> [0.000000] [sd_task/INFO] Displaying task 7->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: 10014000
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 1
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     7
> [0.000000] [sd_task/INFO]   - post-dependencies:
> [0.000000] [sd_task/INFO]     end
> [0.000000] [sd_task/INFO] Displaying task root->5
> [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: 10014000
> [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]     5
> [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: 10000000129
> [0.000000] [sd_task/INFO]   - Dependencies to satisfy: 2
> [0.000000] [sd_task/INFO]   - pre-dependencies:
> [0.000000] [sd_task/INFO]     9
> [0.000000] [sd_task/INFO]     7->end
> [0.000000] [test/INFO] ------------------- Schedule tasks ---------------------------
> [0.000000] [test/INFO] ------------------- Run the schedule ---------------------------
> [110.005082] [test/INFO] ------------------- Produce the trace file---------------------------
> [110.005082] [test/INFO] Producing the trace of the run into dag.trace

$ cat ${srcdir:=.}/dag-dotload/dag.trace
> [0.000000->0.000000] node-0.acme.org compute 0.000000 flops # root
> [0.000000->10.000000] node-1.acme.org compute 10000000129.452715 flops # 0
> [10.001680->20.001680] node-10.acme.org compute 10000000131.133657 flops # 1
> [20.002360->30.002360] node-11.acme.org compute 10000000121.124870 flops # 2
> [30.003040->40.003041] node-12.acme.org compute 10000000230.608025 flops # 3
> [40.003041->50.003041] node-13.acme.org compute 10000000004.994019 flops # 4
> [50.003721->60.003721] node-14.acme.org compute 10000000046.016401 flops # 5
> [60.003721->70.003721] node-15.acme.org compute 10000000091.598791 flops # 6
> [70.004401->80.004401] node-16.acme.org compute 10000000040.679438 flops # 7
> [80.005081->90.005081] node-17.acme.org compute 10000000250.490017 flops # 8
> [90.005081->100.005081] node-18.acme.org compute 10000000079.267649 flops # 9
> [10.000000 -> 10.001680] node-1.acme.org -> node-10.acme.org transfer of 10001 bytes # 0->1
> [20.001680 -> 20.002360] node-10.acme.org -> node-11.acme.org transfer of 10004 bytes # 1->2
> [30.002360 -> 30.003040] node-11.acme.org -> node-12.acme.org transfer of 10002 bytes # 2->3
> [50.003041 -> 50.003721] node-13.acme.org -> node-14.acme.org transfer of 10029 bytes # 4->5
> [70.003721 -> 70.004401] node-15.acme.org -> node-16.acme.org transfer of 10005 bytes # 6->7
> [80.004401 -> 80.005081] node-16.acme.org -> node-17.acme.org transfer of 10000 bytes # 7->8
> [80.004401 -> 80.086113] node-16.acme.org -> node-0.acme.org transfer of 10014000 bytes # 7->end
> [0.000000 -> 0.081712] node-0.acme.org -> node-14.acme.org transfer of 10014000 bytes # root->5
> [100.005081->110.005082] node-0.acme.org compute 10000000129.452715 flops # end

$ rm -f ${srcdir:=.}/dag-dotload/dag.trace ${srcdir:=.}/dot.dot

! expect return 2
$ $SG_TEST_EXENV ${bindir:=.}/dag-dotload/sd_dag-dotload --log=no_loc ${srcdir:=.}/../platforms/two_clusters.xml ${srcdir:=.}/dag-dotload/dag_with_cycle.dot
> [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 is in a cycle
> [0.000000] [sd_daxparse/WARNING] the task 2 is in a cycle
> [0.000000] [sd_daxparse/WARNING] the task 3 is in a cycle
> [0.000000] [sd_daxparse/WARNING] the task 4 is in a cycle
> [0.000000] [sd_daxparse/WARNING] the task 5 is in a cycle
> [0.000000] [sd_daxparse/WARNING] the task 6 is in a cycle
> [0.000000] [sd_dotparse/ERROR] The DOT described in dag_with_cycle.dot is not a DAG. It contains a cycle.
> [0.000000] [test/CRITICAL] No dot loaded. Do you have a cycle in your graph?
