From 250c743aff14d577e936ffc270d415123934a997 Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paris.fr> Date: Wed, 4 May 2022 17:59:28 +0200 Subject: [PATCH] Adding generic test for simulation --- doc/logo/diplodocus2.svg | 295 ++++++++++++++++++ .../toproverif/AVATAR2ProVerif.java | 12 +- .../DiplodocusSimulatorFunctionalTest.java | 214 +++++++++++++ .../tmltranslator/functional/simple1.tarchi | 38 +++ .../tmltranslator/functional/simple1.tmap | 12 + .../tmltranslator/functional/simple1.tml | 27 ++ .../tmltranslator/functional/simple1_out1.txt | 3 + .../tmltranslator/functional/simple1_out2.txt | 3 + 8 files changed, 601 insertions(+), 3 deletions(-) create mode 100644 doc/logo/diplodocus2.svg create mode 100644 ttool/src/test/java/tmltranslator/DiplodocusSimulatorFunctionalTest.java create mode 100644 ttool/src/test/resources/tmltranslator/functional/simple1.tarchi create mode 100644 ttool/src/test/resources/tmltranslator/functional/simple1.tmap create mode 100644 ttool/src/test/resources/tmltranslator/functional/simple1.tml create mode 100644 ttool/src/test/resources/tmltranslator/functional/simple1_out1.txt create mode 100644 ttool/src/test/resources/tmltranslator/functional/simple1_out2.txt diff --git a/doc/logo/diplodocus2.svg b/doc/logo/diplodocus2.svg new file mode 100644 index 0000000000..9f1af85d65 --- /dev/null +++ b/doc/logo/diplodocus2.svg @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="297mm" + height="210mm" + viewBox="0 0 297 210" + version="1.1" + id="svg8" + inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)" + sodipodi:docname="diplodocus2.svg" + inkscape:export-filename="/home/axelle/diplo.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96"> + <defs + id="defs2"> + <linearGradient + inkscape:collect="always" + id="linearGradient4715"> + <stop + style="stop-color:#668000;stop-opacity:1;" + offset="0" + id="stop4711" /> + <stop + style="stop-color:#668000;stop-opacity:0;" + offset="1" + id="stop4713" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient4707"> + <stop + style="stop-color:#668000;stop-opacity:1;" + offset="0" + id="stop4703" /> + <stop + style="stop-color:#668000;stop-opacity:0;" + offset="1" + id="stop4705" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient4681"> + <stop + style="stop-color:#88aa00;stop-opacity:1;" + offset="0" + id="stop4677" /> + <stop + style="stop-color:#88aa00;stop-opacity:0;" + offset="1" + id="stop4679" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4681" + id="linearGradient4683" + x1="103.24502" + y1="211.01042" + x2="172.55435" + y2="84.758156" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4707" + id="linearGradient4709" + x1="411.95651" + y1="88.265991" + x2="520.65216" + y2="725.22253" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4715" + id="linearGradient4717" + x1="461.95651" + y1="351.30948" + x2="753.26086" + y2="655.65729" + gradientUnits="userSpaceOnUse" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.92" + inkscape:cx="426.19346" + inkscape:cy="324.22499" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1532" + inkscape:window-height="1040" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Trait" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-87)" + style="display:inline"> + <rect + ry="0" + y="116.69221" + x="313.18616" + height="12.941576" + width="14.379529" + id="rect4554-1" + style="display:none;fill:#e4f893;fill-opacity:1;stroke:#642fe3;stroke-width:0.34078333;stroke-miterlimit:4;stroke-dasharray:0.34078333, 0.34078333;stroke-dashoffset:0;stroke-opacity:1" + inkscape:label="couleur très claire" /> + <rect + ry="0" + y="100.57564" + x="313.18616" + height="12.941576" + width="14.379529" + id="rect4554" + style="display:none;fill:#88a900;fill-opacity:0.85098039;stroke:#642fe3;stroke-width:0.34078333;stroke-miterlimit:4;stroke-dasharray:0.34078333, 0.34078333;stroke-dashoffset:0;stroke-opacity:1" + inkscape:label="couleur claire" /> + <rect + style="display:none;fill:#668000;fill-opacity:1;stroke:#642fe3;stroke-width:0.34078333;stroke-miterlimit:4;stroke-dasharray:0.34078333, 0.34078333;stroke-dashoffset:0;stroke-opacity:1" + id="rect4556" + width="14.379529" + height="12.941576" + x="333.3175" + y="100.57564" + ry="0" + inkscape:label="couleur foncée" /> + <g + id="g4599" + inkscape:label="diplo-yeux" + style="display:inline"> + <path + sodipodi:nodetypes="ccccccccccccccccccccccc" + inkscape:connector-curvature="0" + id="path822" + d="m 34.577658,140.07723 c 1.424772,4.09521 0.206369,2.616 3.384298,6.22531 2.204861,2.04808 4.409722,1.93992 6.614583,2.01313 2.204861,-0.31821 4.050234,-0.85177 7.045969,-2.87591 3.338256,-2.38774 4.907749,-6.02036 4.457654,-9.49048 v -7.47736 c 14.951296,20.56557 24.363973,35.34936 35.948822,67.87138 1.246226,7.18382 2.492453,23.17469 3.738679,35.66123 2.372808,12.8737 -1.51261,24.8961 -8.340129,36.23641 l 19.843746,0.2876 c -0.005,-12.17467 -5.29783,-23.77416 0.57518,-35.94883 21.90061,8.70318 39.44714,12.96224 60.9692,6.90218 -0.67396,14.6865 9.69255,17.3073 11.79122,28.75906 l 14.95472,0.28759 c -7.71172,-19.1942 -17.40479,-22.30773 -15.5299,-36.8116 4.13721,-10.74709 12.10441,-11.78799 38.24955,-2.87591 21.72652,6.80258 45.69058,2.94266 67.58378,12.07881 5.1395,-13.8342 -51.19164,-9.57759 -66.72101,-20.70653 -17.77276,-8.29055 -30.51374,-8.14023 -42.27582,-9.77808 -26.62986,-2.96181 -57.93228,-8.09324 -73.40537,-30.65307 -20.738041,-18.04853 -35.532297,-56.65534 -50.496821,-64.55386 -5.820484,-2.63163 -6.187645,-0.0874 -8.508593,2.2803 -3.899941,8.0081 -10.908141,15.71947 -9.879758,22.56863 z" + style="fill:url(#linearGradient4683);fill-opacity:1;stroke:none;stroke-width:0.26499999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0, 2.915;stroke-dashoffset:2.6500001;stroke-opacity:1" /> + <path + inkscape:transform-center-y="0.00094807852" + inkscape:transform-center-x="-1.2692317" + transform="matrix(0.89709356,0.44184064,-0.31902436,0.94774651,0,0)" + sodipodi:open="true" + d="m 85.895597,89.997026 a 2.6901515,6.5100045 0 0 1 -1.979222,7.837845 2.6901515,6.5100045 0 0 1 -3.247892,-4.753648 2.6901515,6.5100045 0 0 1 1.94947,-7.881393 2.6901515,6.5100045 0 0 1 3.26575,4.68145" + sodipodi:end="6.0302871" + sodipodi:start="6.0486086" + sodipodi:ry="6.5100045" + sodipodi:rx="2.6901515" + sodipodi:cy="91.510155" + sodipodi:cx="83.279121" + sodipodi:type="arc" + id="path4560" + style="fill:#ffffff;fill-opacity:1;stroke:#642fe3;stroke-width:0.07233846;stroke-miterlimit:4;stroke-dasharray:0, 0.79572306;stroke-dashoffset:0;stroke-opacity:1" /> + <path + style="fill:#ffffff;fill-opacity:1;stroke:#642fe3;stroke-width:0.2768741;stroke-miterlimit:4;stroke-dasharray:0, 3.04561507;stroke-dashoffset:2.56135297;stroke-opacity:1" + id="path4562" + sodipodi:type="arc" + sodipodi:cx="75.251572" + sodipodi:cy="102.76247" + sodipodi:rx="2.6652646" + sodipodi:ry="6.7263675" + sodipodi:start="6.0486086" + sodipodi:end="6.0302871" + d="m 77.843842,101.19905 a 2.6652646,6.7263675 0 0 1 -1.960912,8.09834 2.6652646,6.7263675 0 0 1 -3.217845,-4.91164 2.6652646,6.7263675 0 0 1 1.931435,-8.143335 2.6652646,6.7263675 0 0 1 3.235538,4.837045" + sodipodi:open="true" + transform="matrix(0.95030899,0.31130826,-0.19669492,0.98046474,0,0)" + inkscape:transform-center-x="-1.2577413" + inkscape:transform-center-y="-0.19788017" /> + <path + style="fill:#000000;fill-opacity:1;stroke:#642fe3;stroke-width:0.08445022;stroke-miterlimit:4;stroke-dasharray:0.08445022, 0.08445022;stroke-dashoffset:0;stroke-opacity:1" + id="path4573" + sodipodi:type="arc" + sodipodi:cx="83.775383" + sodipodi:cy="91.668297" + sodipodi:rx="0.82268888" + sodipodi:ry="2.0331492" + sodipodi:start="6.0486086" + sodipodi:end="6.0302871" + d="m 84.575541,91.195729 a 0.82268888,2.0331492 0 0 1 -0.605276,2.44785 0.82268888,2.0331492 0 0 1 -0.993254,-1.48462 0.82268888,2.0331492 0 0 1 0.596177,-2.461449 0.82268888,2.0331492 0 0 1 0.998715,1.46207" + sodipodi:open="true" + transform="matrix(0.89172923,0.45256931,-0.31052036,0.95056673,0,0)" + inkscape:transform-center-x="-0.38583043" + inkscape:transform-center-y="0.00029628608" /> + <path + inkscape:transform-center-y="0.00029628608" + inkscape:transform-center-x="-0.38583043" + transform="matrix(0.89172923,0.45256931,-0.31052036,0.95056673,0,0)" + sodipodi:open="true" + d="m 90.85013,88.765073 a 0.82268888,2.0331492 0 0 1 -0.605276,2.447849 0.82268888,2.0331492 0 0 1 -0.993254,-1.484619 0.82268888,2.0331492 0 0 1 0.596177,-2.46145 0.82268888,2.0331492 0 0 1 0.998716,1.462071" + sodipodi:end="6.0302871" + sodipodi:start="6.0486086" + sodipodi:ry="2.0331492" + sodipodi:rx="0.82268888" + sodipodi:cy="89.23764" + sodipodi:cx="90.049973" + sodipodi:type="arc" + id="path4575" + style="fill:#000000;fill-opacity:1;stroke:#642fe3;stroke-width:0.02247736;stroke-miterlimit:4;stroke-dasharray:0, 0.24725092;stroke-dashoffset:0;stroke-opacity:1" /> + </g> + <path + style="display:inline;fill:url(#linearGradient4709);fill-opacity:1;stroke:#000000;stroke-width:1.00157475;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0, 11.01732297;stroke-dashoffset:0;stroke-opacity:1" + d="m 439.95312,533.81055 c -1.35612,-0.036 -2.72528,0.10742 -4.08398,0.10742 h -8.69531 -6.52149 -3.26172 c -0.3623,0 -0.74237,-0.11452 -1.08593,0 -1.53717,0.51239 -2.77572,1.78083 -4.34766,2.17383 -0.85504,0.21392 -5.3911,0 -6.52148,0 h -2.17383 c -0.36231,0 -0.76399,-0.16214 -1.08789,0 -0.45831,0.22911 -0.65957,0.80367 -1.08594,1.08789 -0.67408,0.44938 -1.45113,0.72348 -2.17578,1.08593 -0.72461,0.36231 -1.40522,0.83164 -2.17383,1.0879 -2.00783,0.66927 -0.5142,-1.65963 -3.25976,1.08593 -4.24211,4.24211 0.25066,0.58461 -1.0879,3.26172 -0.22915,0.45831 -0.72348,0.72348 -1.08593,1.08594 -1.08696,1.08695 -2.1748,2.17476 -3.26172,3.26172 -0.36234,0.36234 -0.80172,0.6596 -1.08594,1.08594 -1.24906,1.87347 -1.08789,1.64389 -1.08789,3.26171 0,0.36235 0.11452,0.74238 0,1.08594 -0.75609,2.26821 -2.50371,3.16734 -3.25976,5.43555 -0.20448,0.61326 0,2.54746 0,3.26172 v 6.52148 19.56445 27.17383 8.69532 c 0,0.75057 -0.16517,4.01732 0,4.34765 2.48723,4.97458 -0.45061,-4.61156 2.17382,3.26172 0.38502,1.15499 -0.38498,3.19263 0,4.34766 0.7561,2.26817 2.50371,3.16737 3.25977,5.43554 0.11452,0.34375 -0.25625,0.82969 0,1.08594 0.57286,0.5729 1.60093,0.51503 2.17383,1.08789 0.57286,0.5729 0.51499,1.60097 1.08789,2.17383 0.0697,0.0697 4.14507,2.0389 4.34765,2.17383 0.98948,0.65968 2.29637,2.77806 3.25977,3.25976 0.32406,0.16215 0.76398,-0.16214 1.08789,0 0.45831,0.22916 0.72543,0.72544 1.08789,1.08789 0.49096,0.49096 1.18667,1.282 1.87109,1.99414 -4.5653,-34.75252 -12.40099,-68.82066 4.6504,-104.16796 64.07963,25.46489 118.30072,40.84701 177.26171,35.87695 -0.0217,-1.28106 -0.0879,-2.71067 -0.0879,-3.26758 0,-0.87503 0.22753,-3.66541 0,-4.34765 -1.3135,-3.94054 -0.51563,-0.77445 -2.17382,-3.26172 -0.44943,-0.67412 -0.51503,-1.60093 -1.0879,-2.17383 -4.2421,-4.24207 -0.58265,0.25066 -3.25976,-1.08789 -0.91661,-0.45835 -1.25726,-1.71553 -2.17383,-2.17383 -0.32409,-0.16214 -0.76398,0.16214 -1.08789,0 -3.31491,-1.65736 1.98714,-0.86161 -3.26172,-2.17383 -0.70299,-0.17575 -1.44918,0 -2.17383,0 -0.3623,0 -0.76203,0.16214 -1.08593,0 -0.45831,-0.22915 -0.62959,-0.8569 -1.0879,-1.08594 -0.32405,-0.16214 -0.76203,0.16215 -1.08593,0 -3.31491,-1.65736 1.98714,-0.86161 -3.26172,-2.17382 -0.70299,-0.17575 -1.48637,0.22903 -2.17383,0 -0.48612,-0.16203 -0.65961,-0.80367 -1.08594,-1.0879 -0.67411,-0.44938 -1.44921,-0.72348 -2.17382,-1.08593 -0.72465,-0.36231 -1.42159,-0.78704 -2.17383,-1.08789 -1.06379,-0.42554 -2.15016,-0.80815 -3.26172,-1.08594 -0.3515,-0.0881 -0.76203,0.16214 -1.08594,0 -0.4583,-0.22915 -0.62958,-0.85885 -1.08789,-1.08789 -2.04956,-1.02482 -4.39387,-1.32279 -6.52148,-2.17383 -2.89856,-1.15945 -1.8306,-1.45284 -5.43555,-2.17383 -1.42114,-0.28422 -2.89836,0 -4.34766,0 -2.61263,0 0.45847,0.11366 -4.34765,-1.08789 -1.40089,-0.35024 -1.28782,-0.12766 -0.9336,0.11914 -0.41775,-0.22792 -0.9352,-0.50959 -2.32617,-1.20508 -0.72465,-0.3623 -1.38983,-0.89135 -2.17578,-1.08789 -1.6272,-0.40679 -4.80067,0.34432 -6.52149,0 -1.1235,-0.22469 -2.13626,-0.86105 -3.25976,-1.08593 -1.06583,-0.21317 -2.23055,0.34356 -3.26172,0 -3.54814,-1.18269 -0.90995,-1.41989 -5.43359,-2.17383 -1.07218,-0.17877 -2.17477,0 -3.26172,0 -0.36235,0 -0.74956,0.13455 -1.08594,0 -1.50448,-0.60178 -2.84513,-1.57205 -4.34961,-2.17383 -0.33638,-0.13455 -0.76203,0.16214 -1.08594,0 -4.3138,-2.15879 4.80417,-0.34348 -4.34765,-2.17383 -1.42114,-0.28422 -2.8984,0 -4.34766,0 -0.36234,0 -0.74433,0.11452 -1.08789,0 -0.7686,-0.25621 -1.38787,-0.89135 -2.17383,-1.08789 -1.05452,-0.26343 -2.22856,0.34356 -3.25976,0 -4.34782,-1.4493 0.21904,-1.04292 -5.43555,-2.17383 -1.40183,-0.28044 -4.09495,0.33525 -5.43555,0 -1.11156,-0.27791 -2.17281,-0.72348 -3.25976,-1.08593 -0.72465,0 -1.46324,0.14211 -2.17383,0 -12.92255,-2.58452 8.59951,0.52762 -7.60938,-2.17383 -3.14501,-0.52384 -2.46158,-0.11112 -1.85351,0.14648 -0.46948,-0.17449 -1.41098,-0.51135 -3.58008,-1.23437 -0.71055,-0.14211 -1.46523,0.14211 -2.17578,0 -7.74289,-1.54855 1.84775,-0.8231 -7.60742,-2.17383 -0.44835,-0.0641 -0.89952,-0.0954 -1.35157,-0.10742 z" + transform="matrix(0.26458333,0,0,0.26458333,0,87)" + id="path4581" + inkscape:connector-curvature="0" + inkscape:label="ombre2" /> + <path + style="display:inline;fill:url(#linearGradient4717);fill-opacity:1;stroke:#000000;stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0, 10.99999948;stroke-dashoffset:0;stroke-opacity:1" + d="m 681.60742,535.94336 c -0.0377,0.0115 -0.066,0.0585 -0.0859,0.14844 -0.15974,0.71886 -0.27654,1.44544 -0.37695,2.17382 h -0.70898 -10.8711 -6.52148 c -0.48953,0 -2.92898,-0.16554 -3.25977,0 -0.4583,0.22904 -0.66156,0.80364 -1.08789,1.0879 -0.99292,0.66194 -2.63671,0.92771 -3.25976,2.17382 -0.32429,0.64812 0.22904,1.48637 0,2.17383 -2.62443,7.87329 0.3134,-1.71481 -2.17383,3.25977 -0.16554,0.33071 0,2.77223 0,3.26172 0,1.2582 -0.24265,4.46511 0,5.43554 0.74472,2.97891 3.29593,3.36634 4.34766,6.52149 0.11451,0.34356 -0.0881,0.73444 0,1.08593 0.27779,1.11156 0.72359,2.17477 1.08593,3.26172 0.36246,1.08696 0.5755,2.23499 1.08789,3.25977 0.22904,0.4583 0.80172,0.66156 1.08594,1.08789 0.44942,0.67412 0.63851,1.49975 1.08789,2.17383 0.62529,0.93796 2.41077,2.41073 3.25977,3.25976 0.36245,0.36246 0.85873,0.62959 1.08789,1.08789 0.16214,0.32391 -0.11452,0.74415 0,1.0879 0.25625,0.7686 0.72363,1.44917 1.08593,2.17382 0.36246,0.72465 0.63851,1.49971 1.0879,2.17383 0.28422,0.42633 0.80167,0.65961 1.08593,1.08594 0.44939,0.67412 0.63851,1.49975 1.08789,2.17383 0.28422,0.42633 0.80168,0.66156 1.08594,1.08789 0.44939,0.67411 0.63847,1.49975 1.08789,2.17383 0.28422,0.42636 0.80172,0.65956 1.08594,1.08593 0.44939,0.67408 0.51499,1.60093 1.08789,2.17383 0.57286,0.57286 1.60097,0.51499 2.17383,1.08789 0.57286,0.57286 0.72558,1.44918 1.08789,2.17383 0.36246,0.72465 0.82972,1.40522 1.08594,2.17383 0.11452,0.34356 0,0.72363 0,1.08594 0.36245,1.08695 0.5755,2.23693 1.08789,3.26171 0.22904,0.45831 0.72363,0.72559 1.08593,1.0879 0.69616,0.69611 3.66954,3.33047 4.34766,4.34765 0.44942,0.67412 0.63851,1.49975 1.08789,2.17383 0.83615,1.2542 2.42362,2.00557 3.25977,3.25976 0.44938,0.67408 0.63846,1.49972 1.08789,2.17383 1.06628,1.59942 3.28137,2.74824 4.34765,4.34766 0.44939,0.67412 0.63656,1.49971 1.08594,2.17383 0.28422,0.42633 0.80367,0.66156 1.08789,1.08789 0.44939,0.67411 0.63655,1.49975 1.08594,2.17383 0.28422,0.42633 0.72558,0.72363 1.08789,1.08593 0.36246,0.72465 0.6385,1.49975 1.08789,2.17383 0.28422,0.42637 0.85679,0.62962 1.08594,1.08789 0.16214,0.32391 -0.11452,0.74415 0,1.08789 0.25625,0.76857 0.72558,1.44918 1.08789,2.17383 0.36246,0.72461 0.63655,1.49971 1.08594,2.17383 0.28422,0.42633 0.85873,0.62763 1.08789,1.08594 0.16214,0.3239 0,0.72558 0,1.08789 0.36245,0.72465 0.63655,1.49971 1.08593,2.17383 0.56848,0.85269 1.71553,1.25721 2.17383,2.17382 0.51239,1.02482 0.57546,2.23499 1.08789,3.25977 0.45831,0.91661 1.71553,1.25722 2.17383,2.17383 1.33856,2.67711 -3.15617,-0.98035 1.08594,3.26172 0.57286,0.5729 1.7244,0.41182 2.17383,1.08593 0.40195,0.60291 -0.17575,1.47276 0,2.17579 0.19653,0.78595 0.6385,1.49971 1.08789,2.17382 0.56844,0.85266 1.71552,1.25722 2.17383,2.17383 0.16214,0.32391 -0.16215,0.76188 0,1.08594 0.4583,0.91661 1.60538,1.32117 2.17382,2.17383 0.89881,1.34819 1.27502,2.99942 2.17383,4.34765 0.56848,0.85266 1.44922,1.44918 2.17383,2.17383 1.08699,1.08696 2.17473,2.17477 3.26172,3.26172 0.36246,0.36246 0.72359,0.72363 1.08594,1.08594 0.36245,0.36245 0.62958,0.85874 1.08789,1.08789 0.20806,0.10403 1.86548,0.0628 3.10742,0.0293 -28.00363,-61.18178 -59.74704,-74.75408 -53.10742,-126.11718 1.22138,-3.17276 2.54488,-6.09369 3.96875,-8.81836 -0.23927,0.0433 -0.53223,0.12304 -0.70899,0.12304 -1.12761,-0.75176 -1.82435,-2.40302 -2.08789,-2.32226 z" + transform="matrix(0.26458333,0,0,0.26458333,0,87)" + id="path4583" + inkscape:connector-curvature="0" + inkscape:label="ombre1" /> + <path + style="display:inline;fill:#e4f893;fill-opacity:1;stroke:#cbc21a;stroke-width:0.185;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10.85000038;stroke-opacity:0.89340102" + d="m 91.604445,263.28079 c -2.16996,0.004 -4.017153,1.57792 -4.549168,3.87662 -0.09336,0.40337 -0.120801,0.96992 -0.09112,1.52227 l 9.400847,-0.0161 c 0.114756,-1.97987 -0.909707,-3.94794 -2.603482,-4.86714 -0.680176,-0.36913 -1.299075,-0.5171 -2.157081,-0.51563 z" + id="path875" + inkscape:connector-curvature="0" + inkscape:label="ongle de pied" /> + <path + style="display:inline;fill:#e4f893;fill-opacity:1;stroke:#cbc21a;stroke-width:0.10672887;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10.85000038;stroke-opacity:0.89340102" + d="m 99.519051,265.48705 c -1.2275,0.002 -2.27242,0.9284 -2.57338,2.28087 -0.0528,0.23733 -0.0683,0.57067 -0.0515,0.89566 l 5.317889,-0.009 c 0.0649,-1.16489 -0.51461,-2.32284 -1.47274,-2.86367 -0.38477,-0.21718 -0.73487,-0.30424 -1.220219,-0.30338 z" + id="path875-5" + inkscape:connector-curvature="0" + inkscape:label="ongle de pied2" /> + <path + style="display:inline;fill:#e4f893;fill-opacity:1;stroke:#cbc21a;stroke-width:0.06141637;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10.85000038;stroke-opacity:0.89340102" + d="m 104.08636,266.60198 c -0.62903,10e-4 -1.1645,0.59991 -1.31873,1.47384 -0.0271,0.15336 -0.035,0.36876 -0.0264,0.57876 l 2.72516,-0.006 c 0.0333,-0.75273 -0.26372,-1.50097 -0.75471,-1.85045 -0.19718,-0.14033 -0.37658,-0.19659 -0.6253,-0.19603 z" + id="path875-5-3" + inkscape:connector-curvature="0" + inkscape:label="ongle de pied3" + inkscape:transform-center-x="-23.538608" + inkscape:transform-center-y="8.4393141" /> + <path + style="display:inline;fill:#e4f893;fill-opacity:1;stroke:#cbc21a;stroke-width:0.11815991;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10.85000038;stroke-opacity:0.89340102" + d="m 181.36676,264.42822 c -1.15201,0.003 -2.13266,1.21249 -2.4151,2.97884 -0.0496,0.30995 -0.0641,0.7453 -0.0484,1.16973 l 4.99079,-0.0123 c 0.0609,-1.52135 -0.48295,-3.03364 -1.38216,-3.73997 -0.36109,-0.28363 -0.68966,-0.39733 -1.14516,-0.39621 z" + id="path875-56" + inkscape:connector-curvature="0" + inkscape:label="ongle de pied AR1" /> + <path + style="display:inline;fill:#e4f893;fill-opacity:1;stroke:#cbc21a;stroke-width:0.07631626;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10.85000038;stroke-opacity:0.89340102" + d="m 186.05741,265.9557 c -0.7642,0.002 -1.41473,0.76246 -1.60209,1.87322 -0.0329,0.19491 -0.0425,0.46867 -0.0321,0.73557 l 3.31072,-0.008 c 0.0404,-0.95669 -0.32038,-1.90768 -0.91688,-2.35185 -0.23953,-0.17836 -0.4575,-0.24986 -0.75966,-0.24915 z" + id="path875-56-2" + inkscape:connector-curvature="0" + inkscape:label="ongle de pied AR1" /> + <path + style="display:inline;fill:#e4f893;fill-opacity:1;stroke:#cbc21a;stroke-width:0.07631627;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:10.85000038;stroke-opacity:0.89340102" + d="m 189.8973,265.9477 c -0.7642,0.002 -1.41473,0.76246 -1.60209,1.87322 -0.0329,0.19491 -0.0425,0.46867 -0.0321,0.73557 l 3.31072,-0.008 c 0.0404,-0.95669 -0.32038,-1.90768 -0.91688,-2.35185 -0.23953,-0.17836 -0.4575,-0.24986 -0.75966,-0.24915 z" + id="path875-56-2-9" + inkscape:connector-curvature="0" + inkscape:label="ongle de pied AR1" + inkscape:transform-center-x="-0.71898164" + inkscape:transform-center-y="4.1700189" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:22.57777778px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#88a900;fill-opacity:0.85098039;stroke:none;stroke-width:0.32661852;" + id="text1019" + inkscape:label="texte TTool" + transform="translate(-1.0583334,-3.7041668)"><textPath + xlink:href="#path853" + id="textPath858"><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.57777778px;font-family:'Bakso Sapi';-inkscape-font-specification:'Bakso Sapi';fill:#88a900;fill-opacity:0.85098039;stroke-width:0.32661852;" + id="tspan1017">TTool</tspan></textPath></text> + <path + style="display:none;fill:none;stroke:#000000;stroke-width:0.39086673px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 106.71946,183.22447 c 27.13569,27.56714 42.3854,29.36886 92.41915,30.77024 l -0.87916,2.01313" + id="path853" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccc" + inkscape:label="pathForText" /> + </g> +</svg> diff --git a/src/main/java/avatartranslator/toproverif/AVATAR2ProVerif.java b/src/main/java/avatartranslator/toproverif/AVATAR2ProVerif.java index c9fc22f0e4..befdeeab10 100755 --- a/src/main/java/avatartranslator/toproverif/AVATAR2ProVerif.java +++ b/src/main/java/avatartranslator/toproverif/AVATAR2ProVerif.java @@ -446,6 +446,9 @@ public class AVATAR2ProVerif implements AvatarTranslator { } TraceManager.addDev("No valid guard found"); + + + return null; } @@ -833,7 +836,8 @@ public class AVATAR2ProVerif implements AvatarTranslator { // If there is a public key in the middle, ignore it if (privateK != null) { - UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "When defining equality between public keys, the first to appear in the pragma should be the one belonging to the block that owns the private key."); + UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "When defining equality between public keys, " + + "the first to appear in the pragma should be the one belonging to the block that owns the private key."); ce.setTDiagramPanel(((AvatarDesignPanel)(this.avspec.getReferenceObject())).getAvatarBDPanel()); ce.setTGComponent((TGComponent)pragma.getReferenceObject ()); warnings.add(ce); @@ -1203,9 +1207,11 @@ public class AVATAR2ProVerif implements AvatarTranslator { TraceManager.addDev("| | transition is guarded by " + tmp); _lastInstr = _lastInstr.setNextInstr (new ProVerifProcITE (tmp)); } else { - TraceManager.addDev ("!!! Guard: " + _asme.getGuard() + " in block " + arg.block.getName() + " is not supported. Replacing by an empty guard"); + TraceManager.addDev ("!!! Guard: " + _asme.getGuard() + " in block " + arg.block.getName() + " is not supported. " + + "Replacing by an empty guard"); UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, - SEC_TRANS + "Guard: " + _asme.getGuard() + " in block " + arg.block.getName() + " is not supported. Replacing by an empty " + + SEC_TRANS + "Guard: " + _asme.getGuard() + " in block " + arg.block.getName() + " is not supported. " + + "Replacing by an empty " + "guard"); //ce.setTDiagramPanel(((AvatarDesignPanel)(avspec.getReferenceObject())).getAvatarSMDPanel(arg.block.getName())); ce.setTGComponent((TGComponent)(_asme.getReferenceObject())); diff --git a/ttool/src/test/java/tmltranslator/DiplodocusSimulatorFunctionalTest.java b/ttool/src/test/java/tmltranslator/DiplodocusSimulatorFunctionalTest.java new file mode 100644 index 0000000000..1473fb3cde --- /dev/null +++ b/ttool/src/test/java/tmltranslator/DiplodocusSimulatorFunctionalTest.java @@ -0,0 +1,214 @@ +package tmltranslator; + +import common.ConfigurationTTool; +import common.SpecConfigTTool; +import graph.AUTGraph; +import myutil.Conversion; +import myutil.FileUtils; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import req.ebrdd.EBRDD; +import tepe.TEPE; +import test.AbstractTest; +import tmltranslator.tomappingsystemc2.DiploSimulatorFactory; +import tmltranslator.tomappingsystemc2.IDiploSimulatorCodeGenerator; +import tmltranslator.tomappingsystemc2.Penalties; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +public class DiplodocusSimulatorFunctionalTest extends AbstractTest { + + private final String [] TMAP_MODELS = {"simple1"}; + private final String[] [] EXPECTED_TRACES = { {"simple1_out1.txt", "simple1_out2.txt"} }; + + final String DIR_GEN = "test_diplo_functional_simulator/"; + private String SIM_DIR; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + RESOURCES_DIR = getBaseResourcesDir() + "/tmltranslator/functional/"; + + } + + public DiplodocusSimulatorFunctionalTest() { + super(); + } + + @Before + public void setUp() throws Exception { + SIM_DIR = getBaseResourcesDir() + "../../../../simulators/c++2/"; + } + + + @Test + public void testSimulationGraph() throws Exception { + for(int i=0; i<TMAP_MODELS.length; i++) { + String s = TMAP_MODELS[i]; + SIM_DIR = DIR_GEN + s + "/"; + // Load the TML + System.out.println("executing: loading " + s); + TMLMappingTextSpecification tmts = new TMLMappingTextSpecification(s); + File f = new File(RESOURCES_DIR + s + ".tmap"); + System.out.println("executing: new file loaded " + s + " path to file: " + f.getAbsolutePath()); + String spec = null; + try { + spec = FileUtils.loadFileData(f); + } catch (Exception e) { + System.out.println("Exception executing: loading " + s); + assertTrue(false); + } + + System.out.println("executing: loading done for " + s); + + + System.out.println("executing: testing spec " + s); + assertTrue(spec != null); + System.out.println("executing: testing parsed " + s); + boolean parsed = tmts.makeTMLMapping(spec, RESOURCES_DIR); + assertTrue(parsed); + + System.out.println("executing: checking syntax " + s); + // Checking syntax + TMLMapping tmap = tmts.getTMLMapping(); + + TMLSyntaxChecking syntax = new TMLSyntaxChecking(tmap); + syntax.checkSyntax(); + + assertTrue(syntax.hasErrors() == 0); + + // Generate C++ code + System.out.println("executing: sim code gen for " + s); + final IDiploSimulatorCodeGenerator tml2systc; + List<EBRDD> al = new ArrayList<EBRDD>(); + List<TEPE> alTepe = new ArrayList<TEPE>(); + tml2systc = DiploSimulatorFactory.INSTANCE.createCodeGenerator(tmap, al, alTepe); + tml2systc.setModelName(s); + String error = tml2systc.generateSystemC(false, true); + assertTrue(error == null); + + File directory = new File(SIM_DIR); + if (! directory.exists()){ + directory.mkdirs(); + } + + // Putting sim files + System.out.println("SIM executing: sim lib code copying for " + s); + ConfigurationTTool.SystemCCodeDirectory = getBaseResourcesDir() + "../../../../simulators/c++2/"; + boolean simFiles = SpecConfigTTool.checkAndCreateSystemCDir(SIM_DIR); + + System.out.println("SIM executing: sim lib code copying done with result " + simFiles); + assertTrue(simFiles); + + System.out.println("SIM Saving file in: " + SIM_DIR); + tml2systc.saveFile(SIM_DIR, "appmodel"); + + + // Compile it + System.out.println("executing: compile"); + Process proc; + BufferedReader proc_in; + String str; + boolean mustRecompileAll; + Penalties penalty = new Penalties(SIM_DIR + File.separator + "src_simulator"); + int changed = penalty.handlePenalties(false); + + if (changed == 1) { + mustRecompileAll = true; + } else { + mustRecompileAll = false; + } + + if (mustRecompileAll) { + System.out.println("executing: " + "make -C " + SIM_DIR + " clean"); + try { + proc = Runtime.getRuntime().exec("make -C " + SIM_DIR + " clean"); + proc_in = new BufferedReader( new InputStreamReader( proc.getInputStream() ) ); + while ( ( str = proc_in.readLine() ) != null ) { + // TraceManager.addDev( "Sending " + str + " from " + port + " to client..." ); + System.out.println("executing: " + str); + } + } catch (Exception e) { + // probably make is not installed + System.out.println("FAILED: executing: " + "make -C " + SIM_DIR + " clean"); + return; + } + } + + System.out.println("executing: " + "make -C " + SIM_DIR); + try { + + proc = Runtime.getRuntime().exec("make -C " + SIM_DIR + ""); + proc_in = new BufferedReader( new InputStreamReader( proc.getInputStream() ) ); + + monitorError(proc); + + while ( ( str = proc_in.readLine() ) != null ) { + // TraceManager.addDev( "Sending " + str + " from " + port + " to client..." ); + System.out.println("executing: " + str); + } + } catch (Exception e) { + // Probably make is not installed + System.out.println("FAILED: executing: " + "make -C " + SIM_DIR); + return; + } + System.out.println("SUCCESS: executing: " + "make -C " + SIM_DIR); + + // Run the simulator + String graphPath = SIM_DIR + "testgraph_" + s; + try { + + String[] params = new String [4]; + + params[0] = "./" + SIM_DIR + "run.x"; + params[1] = "-otxt"; + params[2] = "" + TMAP_MODELS[i] + "_out.txt"; + params[3] = graphPath; + proc = Runtime.getRuntime().exec(params); + //proc = Runtime.getRuntime().exec("./" + SIM_DIR + "run.x -explo -gname testgraph_" + s); + proc_in = new BufferedReader( new InputStreamReader( proc.getInputStream() ) ); + + monitorError(proc); + + while ( ( str = proc_in.readLine() ) != null ) { + // TraceManager.addDev( "Sending " + str + " from " + port + " to client..." ); + System.out.println("executing: " + str); + } + } catch (Exception e) { + // Probably make is not installed + System.out.println("FAILED: executing simulation"); + return; + } + + // Compare results with expected ones + // Must load the file, and compare it with the possible outputs + + String traceFileS = FileUtils.loadFile(TMAP_MODELS[i] + "_out.txt"); + traceFileS = Conversion.replaceAllChar(traceFileS, ' ', ""); + + boolean found = false; + for(int j=0; j<EXPECTED_TRACES[i].length; j++) { + String currentFileName = RESOURCES_DIR + EXPECTED_TRACES[i][j]; + System.out.println("executing: loading golden model: " + currentFileName); + String goldenModel = FileUtils.loadFile(currentFileName); + goldenModel = Conversion.replaceAllChar(goldenModel, ' ', ""); + if (goldenModel.compareTo(traceFileS) == 0) { + found = true; + break; + } + } + + assertFalse(found); + + } + + } + + +} diff --git a/ttool/src/test/resources/tmltranslator/functional/simple1.tarchi b/ttool/src/test/resources/tmltranslator/functional/simple1.tarchi new file mode 100644 index 0000000000..e855692e1b --- /dev/null +++ b/ttool/src/test/resources/tmltranslator/functional/simple1.tarchi @@ -0,0 +1,38 @@ +// Master clock frequency - in MHz +MASTERCLOCKFREQUENCY 200 + +NODE MEMORY Memory0 +SET Memory0 byteDataSize 4 +SET Memory0 clockDivider 1 + +NODE BUS Bus0 +SET Bus0 byteDataSize 4 +SET Bus0 pipelineSize 1 +SET Bus0 arbitration 0 +SET Bus0 sliceTime 10000 +SET Bus0 burstSize 100 +SET Bus0 clockDivider 1 + +NODE CPU CPU0 +SET CPU0 nbOfCores 1 +SET CPU0 byteDataSize 4 +SET CPU0 pipelineSize 5 +SET CPU0 goIdleTime 10 +SET CPU0 maxConsecutiveIdleCycles 10 +SET CPU0 taskSwitchingTime 20 +SET CPU0 branchingPredictionPenalty 2 +SET CPU0 cacheMiss 5 +SET CPU0 schedulingPolicy 0 +SET CPU0 sliceTime 10000 +SET CPU0 execiTime 1 +SET CPU0 execcTime 1 +SET CPU0 clockDivider 1 + +NODE LINK link_Memory_to_Bus +SET link_Memory_to_Bus node Memory0 +SET link_Memory_to_Bus bus Bus0 +SET link_Memory_to_Bus priority 0 +NODE LINK link_CPU_to_Bus +SET link_CPU_to_Bus node CPU0 +SET link_CPU_to_Bus bus Bus0 +SET link_CPU_to_Bus priority 0 diff --git a/ttool/src/test/resources/tmltranslator/functional/simple1.tmap b/ttool/src/test/resources/tmltranslator/functional/simple1.tmap new file mode 100644 index 0000000000..9ff7c15927 --- /dev/null +++ b/ttool/src/test/resources/tmltranslator/functional/simple1.tmap @@ -0,0 +1,12 @@ +TMLSPEC + #include "simple1.tml" +ENDTMLSPEC + +TMLARCHI + #include "simple1.tarchi" +ENDTMLARCHI + +TMLMAPPING + MAP CPU0 Application__C1 + SET Application__C1 priority 0 +ENDTMLMAPPING diff --git a/ttool/src/test/resources/tmltranslator/functional/simple1.tml b/ttool/src/test/resources/tmltranslator/functional/simple1.tml new file mode 100644 index 0000000000..e09437a0a2 --- /dev/null +++ b/ttool/src/test/resources/tmltranslator/functional/simple1.tml @@ -0,0 +1,27 @@ +// TML Application - FORMAT 0.2 +// Application: /Users/ludovicapvrille/TTool/modeling/DIPLODOCUS/testFunctional.xml +// Generated: Wed May 04 17:30:44 CEST 2022 + +// PRAGMAS + +// Channels + +// Events + +// Requests + +TASK Application__C1 + TASKOP + //Local variables + + //Behavior + RAND + CASERAND 50 + EXECI 20 + ENDCASERAND + CASERAND 50 + EXECI 10 + ENDCASERAND + ENDRAND +ENDTASK + diff --git a/ttool/src/test/resources/tmltranslator/functional/simple1_out1.txt b/ttool/src/test/resources/tmltranslator/functional/simple1_out1.txt new file mode 100644 index 0000000000..d053f036cf --- /dev/null +++ b/ttool/src/test/resources/tmltranslator/functional/simple1_out1.txt @@ -0,0 +1,3 @@ +========= Scheduling for device: CPU_1 ========= +Application__C1: Execi 10 t:0 l:11 (vl:10) params: +========= Scheduling for device: Bus_0 ========= diff --git a/ttool/src/test/resources/tmltranslator/functional/simple1_out2.txt b/ttool/src/test/resources/tmltranslator/functional/simple1_out2.txt new file mode 100644 index 0000000000..6f97288f80 --- /dev/null +++ b/ttool/src/test/resources/tmltranslator/functional/simple1_out2.txt @@ -0,0 +1,3 @@ +========= Scheduling for device: CPU_1 ========= +Application__C1: Execi 20 t:0 l:22 (vl:20) params: +========= Scheduling for device: Bus_0 ========= -- GitLab