Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Support for using tpds (TITAN Project Descriptor) in Eclipse Titan(How to create and save (=export), load (=import) tpd files, how to create makefile from tpd )
Support for using tpds (TITAN Project Descriptor) in Eclipse Titan [message #1774083] Tue, 10 October 2017 10:01 Go to next message
Jeno Attila Balasko is currently offline Jeno Attila BalaskoFriend
Messages: 80
Registered: September 2013
Location: Budapest, Hungary
Member

This topic is based on a user's mail.
(*) Is there an efficient way to use the *.tpd files when using the test protocols delivered to TITAN?
Yes, definitely. As I see, you follow the rule, that the test ports, protocol modules etc. shall be used in a well defined structure:
${PATH_BASE}/Protocol_Modules/[Prot_module_name/
${PATH_BASE}/Test_Ports/[Test_port_name/
${PATH_BASE}/Libraries/[Library_name]
${PATH_BASE}/Application/[App_name]
The protocols shall be cloned into this structure. (Protocols are available from here:
https://projects.eclipse.org/projects/tools.titan/developer )
This is the prerequisite to use the tpds effectively. We don't give support to this cloning process, it is the user's responsibility. We neither support other git handling.

After this point we give full support. We have full command line and Eclipse solutions to make executable based on tpds.
These are the suggested ways of workings:
Command line:
Prerequisite: titan.core installed on your computer ( available from https://projects.eclipse.org/projects/tools.titan/downloads )

Suppose that you have correct tpd files (see your next question).
1. Go to the folder of your top level directory.

2. Use the command makefilegen (or ttcn3_makefilegen, it is aliased) with the switch -t:
makefilegen -f -g -t Your_TopLevelProject.tpd

The command will create a bin folder according to Your_TopLevelProject.tpd.
After then it will link all files into that directory and creates a Makefile in that directory.
It sets all switches, options - everything! - in your Makefile
See details in chapter 6.1.3, "Using the Makefile Generator to Generate Makefile(s) from Titan Project Descriptor file(s)" of the referenceguide.pdf/doc (2/198 17-CRL 113 200/6 Uen, available: https://www.eclipse.org/downloads/download.php?file=/titan/TitanDocuments_6_2_0.zip). Follow the first method, it is the quickest and the best. I sketched that one.

3. Go to the bin directory

4. Execute the command
make


5. Execute the command
ttcn3_start Your_Executable Your_config.cfg


Eclipse:
Prerequisite: Titan Eclipse Plug-ins is installed on your Eclipse. (Available from https://projects.eclipse.org/projects/tools.titan/downloads )

A. Suppose that you have correct tpd files. If not, see the next point "B".
1. Open your Eclipse
2. Select perspective "Titan Editing"
3. Import Your_TopLevelProject.tpd (File>Import...>TITAN>Project from .tpd file). All projects depending from the top level project will be imported, recursively.
4. If any of your project had been modified, store your modification via exporting (Project context menu> Export>TITAN> TITAN Project settings.
Details: Eclipse_Designer_userguide.pdf/doc especially 4.9.5 and 4.9.6

B. If you didn't have tpd files:
1. Open your Eclipse
2. Select perspective "Titan Editing"
3. Import the protocols having tpd files according to point "A" ( For example Our protocol modules, test ports, libraries, applications, that have tpds)
4. Create your Titan projects, for example your test projects.
5. Set the dependencies (Project ctx > Properties > Project References). In Eclipse, if a project uses another project, it "refers it".
6. Create your source files.
7. Set your make preferences ((Project ctx > Properties >TITAN Project Property (and its 3 subtabs) )
8. Export your Titan projects.
Details: Eclipse_Designer_userguide.pdf/doc, especially chapter 4.

(*) Is there a way to create *.tpd files for our test suite repos automatically?
Yes, the previous point "B" described it in nutshell.

[Updated on: Tue, 10 October 2017 10:24]

Report message to a moderator

Re: Support for using tpds (TITAN Project Descriptor) in Eclipse Titan [message #1774592 is a reply to message #1774083] Tue, 17 October 2017 15:24 Go to previous messageGo to next message
Alexander Kaiser is currently offline Alexander KaiserFriend
Messages: 28
Registered: May 2017
Junior Member
Hello Jeno,

thank you for your description. I followed your instruction and built a .tpd file for the iottestware.mqtt Test Suite. Unfortunately, it does not work out of the box.
I have the following referenced projects in my .tpd file:
<ReferencedProjects>
    <ReferencedProject name="IPL4asp_CNL113531" projectLocationURI="../../../Titan/TestPorts/IPL4asp/IPL4asp_CNL113531.tpd"/>
    <ReferencedProject name="Mqtt_v3.1.1_CNL113831" projectLocationURI="../../../Titan/ProtocolModules/MQTT/MQTT_v3.1.1_CNL113831.tpd"/>
  </ReferencedProjects>


And the MQTT_v3.1.1_CNL113831.tpd, in turn, references only the Types and Codecs for positive testing, but in the MQTT Test Suite, we are using only those for negative testing.
  <Files>
    <FileResource projectRelativePath="src/Mqtt_v3.1.1_EncDec.cc" relativeURI="src/Mqtt_v3.1.1_EncDec.cc"/>
    <FileResource projectRelativePath="src/Mqtt_v3.1.1_Types.ttcn" relativeURI="src/Mqtt_v3.1.1_Types.ttcn"/>
  </Files>


Would it be possible to provide two separate .tpd files within the MQTT Protocol Modules?
One for negative and one for positive testing, and just simply excluding the opposite modules. This would allow us to build a .tpd file which references directly to negative testing modules. Users of the MQTT Test Suite (and also users of the MQTT Protocol Module) would no longer need to exclude the additional files by hand.

I have also one additional question about the Makefile settings, respectively the CxxCompiler setting.
I use the clang++-3.8 compiler, which is also set in my .tpd file. I don't want to have this setting in the .tpd, as most users of iottestware.mqtt probably won't start with clang by default. Is it legit, just simply to delete this setting? As the .tpd files from the protocol modules don't have this setting, I assume this will trigger to use a "default" compiler.

Thank you and best regards,
Alexander
Re: Support for using tpds (TITAN Project Descriptor) in Eclipse Titan [message #1774630 is a reply to message #1774592] Wed, 18 October 2017 07:02 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Alex,

if you already have the two *.tpd files, for negative and positive testing, why not contribute it ? :)

I see no problem in deleting the clang flag ; its role is only the convenience of having the Makefile generated with this flag;
but Makefile can be freely edited (preferably when you know exactly what you are doing) so you can add a flag directly to it, or assume the default compiler the Makefile will find ( however if there are many options it might be neater to add the compiler to make it visible).

Best regards
Elemer





Re: Support for using tpds (TITAN Project Descriptor) in Eclipse Titan [message #1774639 is a reply to message #1774083] Wed, 18 October 2017 08:16 Go to previous messageGo to next message
Alexander Kaiser is currently offline Alexander KaiserFriend
Messages: 28
Registered: May 2017
Junior Member
Hi Elemer,

I share the *.tpd files eagerly.

Though, the *.tpds looked and still look somehow slightly different as those in your git repos.
I tried to merge some of the settings from the original MQTT_*.tpd which I was missing in my generated *.tpds. But I still need to dive in a little deeper into the documentation.

Changes I did after the generation by hand:

<generateInternalMakefile>true</generateInternalMakefile>
<GNUMake>true</GNUMake>
<incrementalDependencyRefresh>true</incrementalDependencyRefresh>
<targetExecutable>bin/Mqtt_v3.1.1_CNL113831</targetExecutable>

These settings were not set in the *.tpd, although these settings are activated in Eclipse.

<functiontestRuntime>true</functiontestRuntime>

Removed from pt_*.tpd as I think to remember that we required the functiontest runtime only for negative testing modules.

The reference to the Socket_API module is missing in the original MQTT_*.tpd. I had to dissolve this dependency manually in Eclipse. The generated *.tpd files have this reference automatically.
<ReferencedProjects>
    <ReferencedProject name="Socket_API_CNL113686" projectLocationURI="../../TestPorts/Common_Components/Socket_API_CNL113686/Socket_API_CNL113686.tpd" tpdName="Socket_API_CNL113686.tpd"/>
  </ReferencedProjects>


Best regards,
Alex

Re: Support for using tpds (TITAN Project Descriptor) in Eclipse Titan [message #1774641 is a reply to message #1774639] Wed, 18 October 2017 08:54 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Alex,

I have added the TPDs, thanks.

Best regards
Elemer
Re: Support for using tpds (TITAN Project Descriptor) in Eclipse Titan [message #1774666 is a reply to message #1774630] Wed, 18 October 2017 13:08 Go to previous messageGo to next message
Jeno Attila Balasko is currently offline Jeno Attila BalaskoFriend
Messages: 80
Registered: September 2013
Location: Budapest, Hungary
Member

Hi Alex,

I think Titan project configuration under "Manage Configuration" is what you seek.
It is an other concept of "configuration" than the config set by "configuration file" with extension .cfg.
In a Titan Eclipse project, You have a fixed set of folders, files and referred projects.
Any other set of the project properties ( for example, Makefile settings, set of exluded files and so on) can be collected to "project configurations".
For example, in your case I will sketch a simple project:
1. I created a Hello World project, and added two files, "PositiveTest.ttcn" and "NegativeTest.ttcn" to it.
2. I've created two configurations, "Positive" and "Negative".
3. I've selected proj. config. "Positive" and I've "excluded" file "NegativeTest.ttcn" from the build (This file will not be built) . It models the positive test handling. (see attached file NegativeTestConfig.PNG)
4. I've selected proj.config "Negative" and I've "excluded" "PositiveTest.ttcn".
Here I added a preprocessor macro "NEG_TEST" to this configuration and enabled legacy encoding (see referenceguide.pdf) just to demonstrate the concept of "project configuration".
5. I've exported the project settings into tpd file "HelloWorld.tpd" into the project folder.

Now we have three project configurations: Default, Positive and Negative.
-In Default: there aren't any excluded files, PositiveTest.ttcn and NegativeTest.ttcn contribute to the build. There aren't any extra Makefile settings.
-In Positive: PositiveTest.ttcn is not excluded, NegativeTest.ttcn is excluded. It is used for positive testing
-In Negative: PositiveTest.ttcn is excluded, NegativeTest.ttcn is not excluded. It is used for negative testing.
(If you have Clang and gcc compilers, you can multiply the configurations, and create two additional configs.)

This is just a conceptual description, step by step instructions can be found in Eclipse_Designer_userguide.doc/pdf.

Here is the final tpd (created by Eclipse) (see also in attachment):
<?xml version="1.0" encoding="UTF-8"?>
<TITAN_Project_File_Information version="1.0">
  <ProjectName>HelloWorld</ProjectName>
  <Folders>
    <FolderResource projectRelativePath="src" relativeURI="src"/>
  </Folders>
  <Files>
    <FileResource projectRelativePath="HelloWorld.tpd" relativeURI="HelloWorld.tpd"/>
    <FileResource projectRelativePath="src/MyExample.cfg" relativeURI="src/MyExample.cfg"/>
    <FileResource projectRelativePath="src/MyExample.ttcn" relativeURI="src/MyExample.ttcn"/>
    <FileResource projectRelativePath="src/NegativeTest.ttcn" relativeURI="src/NegativeTest.ttcn"/>
    <FileResource projectRelativePath="src/PCOType.cc" relativeURI="src/PCOType.cc"/>
    <FileResource projectRelativePath="src/PCOType.hh" relativeURI="src/PCOType.hh"/>
    <FileResource projectRelativePath="src/PositiveTest.ttcn" relativeURI="src/PositiveTest.ttcn"/>
  </Files>
  <ActiveConfiguration>Negative</ActiveConfiguration>
  <Configurations>
    <Configuration name="Default">
      <ProjectProperties>
        <MakefileSettings>
          <targetExecutable>bin\HelloWorld.exe</targetExecutable>
        </MakefileSettings>
        <LocalBuildSettings>
          <workingDirectory>bin</workingDirectory>
        </LocalBuildSettings>
      </ProjectProperties>
    </Configuration>
    <Configuration name="Positive">
      <ProjectProperties>
        <MakefileSettings>
          <targetExecutable>bin\HelloWorld.exe</targetExecutable>
        </MakefileSettings>
        <LocalBuildSettings>
          <workingDirectory>bin</workingDirectory>
        </LocalBuildSettings>
      </ProjectProperties>
      <FileProperties>
        <FileResource>
          <FilePath>src/NegativeTest.ttcn</FilePath>
          <FileProperties>
            <ExcludeFromBuild>true</ExcludeFromBuild>
          </FileProperties>
        </FileResource>
      </FileProperties>
    </Configuration>
    <Configuration name="Negative">
      <ProjectProperties>
        <MakefileSettings>
          <targetExecutable>bin\HelloWorld.exe</targetExecutable>
          <TTCN3preprocessorDefines>
            <listItem>NEG_TEST</listItem>
          </TTCN3preprocessorDefines>
          <enableLegacyEncoding>true</enableLegacyEncoding>
        </MakefileSettings>
        <LocalBuildSettings>
          <workingDirectory>bin</workingDirectory>
        </LocalBuildSettings>
      </ProjectProperties>
      <FileProperties>
        <FileResource>
          <FilePath>src/PositiveTest.ttcn</FilePath>
          <FileProperties>
            <ExcludeFromBuild>true</ExcludeFromBuild>
          </FileProperties>
        </FileResource>
      </FileProperties>
    </Configuration>
  </Configurations>
</TITAN_Project_File_Information>


Another comment:
From command line, you can select the active configuration with option "-b", for example:
makefilegen -fg -t HelloWorld.tpd -b Newgative

From Eclipse, you can select the active configuration with (Project) Properties>TITAN Project Property>"The actual build configuration:".

Hopefully it helps.
Regards
Jeno Balasko,
Titan Team,
Ericsson Hungary

[Updated on: Wed, 18 October 2017 13:38]

Report message to a moderator

Re: Support for using tpds (TITAN Project Descriptor) in Eclipse Titan [message #1774733 is a reply to message #1774666] Thu, 19 October 2017 07:52 Go to previous message
Alexander Kaiser is currently offline Alexander KaiserFriend
Messages: 28
Registered: May 2017
Junior Member
Hi Jeno,

you're totally right, this feature satisfies the issue. With that knowledge in mind, the previously proposed solution with two separate tpds seems to be not ideal or at least unpleasant.

I followed your instruction and extended the MQTT_v3.1.1_CNL113831.tpd (see attached file) with the two additional configurations for negative and positive testing.

With this new tpd I'm almost there. When I place the iottestware.mqtt folder accordingly to the Titan modules, I'm able to import it to Eclipse and the three dependencies (IPL4asp, MQTT and Socket_API) in one step. Thanks to the tpds even the dependencies between all the modules are already set correctly. So far, that is exactly the workflow I was looking for :)
There are still some manual steps involved to get the iottestware.mqtt running, but I think it's already a huge improvement.

Thank you for support and best regards,
Alex
Previous Topic:Logging in Eclipse Titan part III: Custom logger plug-ins
Next Topic:New Titan products and user guides in support of IoT testing
Goto Forum:
  


Current Time: Fri Apr 19 21:53:48 GMT 2024

Powered by FUDForum. Page generated in 0.03843 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top