22 Replies Latest reply on Nov 29, 2009 7:53 PM by legrosb

    Building on headless linux

    LeoBent

      Hi

       

      I am trying to run my flexunit4 tests on a headless linux bamboo CI server.

       

      I have got xvfp that runs the flashplayer for me. I am using flashplayer 10 for linux.

       


      My problem is that the build timesout after the policy file is sent.

       

      These are the steps it manages to take:

       

      [flexunit] Creating local trusted file
      [flexunit] opened server socket
      [flexunit] accepting data from client
      [flexunit] start of test run
      [flexunit] sent policy file

       

       

      Then it hangs and finally times out. Any pointers ?

       

      When i run it locally on my windows machine, it runs fine and no policy file is requested, why is that ?

        • 1. Re: Building on headless linux
          legrosb Level 3

          @LeoBent - Sorry about that, this is bug we introduced when we tried to fix another recent bug.  We implemented a handshake between the Flash movie and Ant task that worked for localTrusted=true so we wouldn't drop tests data being sent to the Ant task.  But I foolishly didn't account for when localTrusted="false" and the handshake needed to occur after the policy is sent.

           

          Mike has published a patch I sent a couple days ago to the trunk which fixes this issue along with the Ant task creating the FlashTrustDirectory if it doesn't exist.  Try using the latest flexUnitTasks.jar from the 4.x branch under the FlexUnit4AntTasks project and see if that fixes your problem.  When localTrust=false, the FP will always request a policy file and then reset its connection; when localTrust=true, the FP only requests a policy file if trying to get at something outside of the trust directory.

           

          Let me know how it goes.

           

          -Brian

          • 2. Re: Building on headless linux
            LeoBent Level 1

            I updated the FlexUnit4AntTasks folder, the .jar under the dist folder seemed to be the same one as I was using , so i built a new one.

             

            Now it manges the following steps and then just hangs there:

             

             

            17-sep.-2009 10:23:49    Creating local trusted file

            17-sep.-2009 10:23:49   opened server socket

            17-sep.-2009 10:23:55   accepting data from client

            17-sep.-2009 10:23:55   sent policy file

            17-sep.-2009 10:23:55   accepting data from client

            • 3. Re: Building on headless linux
              LeoBent Level 1

              After trying to run it a couple of times now, i haven't manged to get as far as in my previous post. Now it only gets to "opened server socket" and then times out.

              • 4. Re: Building on headless linux
                LeoBent Level 1

                Update:

                 

                This is also failing locally now.

                • 5. Re: Building on headless linux
                  GavinCroy

                  I'm also seeing the same thing, using latest task jars.

                   

                  I get the following output in the flashplayer log:

                   

                  Warning: [strict] Ignoring policy file with incorrect syntax: xmlsocket://127.0.0.1:1024
                  *** Security Sandbox Violation ***
                  Connection to 127.0.0.1:1024 halted - not permitted from file://<path to swf removed>.swf
                  Error: Request for resource at xmlsocket://127.0.0.1:1024 by requestor from file:///<path to swf removed>swf is denied due to lack of policy file permissions.

                   

                  I'm running on Linux, and can run sample unit tests via antennae's test targets via their own antennae task, but can't run my own (flexunit 4) tests via the flexunit task. I'm using the latest version of Flash Player 10 (standalone debugger) for Linux.

                   

                  I've tried with localtrusted set to true and false....

                  • 6. Re: Building on headless linux
                    legrosb Level 3

                    Based on the feedback I'm seeing here and on a couple other posts, it looks like the FP on Linux may be a different beast than its Windows/Mac counterparts.  I haven't had an opportunity to sit down and hack at the task on Linux recently, so it looks like I'll have to do some walkthroughs to see if I can reprouce these issues.  I do my testing with Ubuntu, for what it's worth.  I'll let y'all know what I find; hopefully I can dig in this weekend.

                     

                    -Brian

                    • 7. Re: Building on headless linux
                      legrosb Level 3

                      Ok, so I've run through tests on a brand new virtual image using Ubuntu 8.10.  I was unable to reproduce any of the problems cited in the above posts.  I'm a pretty big novice when it comes to working with Linux, so below are the steps I used to get the FlexUnit4SampleCIProject working on my virtual image, maybe they can help:

                       

                      - Downloaded Flex SDK 3.4 and installed into /opt/flexsdk/3.4

                      - Ran chmod 777 recursively on /opt/flexsdk/3.4

                      - Downloaded Flash Player 10 for Linux and installed the debug player at /opt/FlashPlayer/debugger/flashplayer

                      - Created a symlink in /usr/local/bin to /opt/FlashPlayer/debugger/flashplayer to add gflashplayer to my path and ran chmod +X on the symlink

                      - Created ~/mm.cfg for the FP debug settings.  The file contains the following:

                       

                      PolicyFileLog=1

                      PolicyFileLogAppend=1

                       

                      - Exported the FlexUnit4SampleCIProject from SVN onto my desktop as ~/Desktop/flexunit4

                      - Changed the ant script to run using localTrusted=false so the policy file would be requested

                      - From within the project folder I ran "ant -v clean package"

                       

                      The tests ran to completion as well as the build script.  My debug output which is located in /home/<user>/.macromedia/Flash_Player/Logs/policyfiles.txt showed the following:

                       

                      OK: Root-level SWF loaded: file:///home/<user>/Desktop/flexunit4/bin/TestRunner.swf
                      OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://127.0.0.1:1024 by requestor from file:///home/<user>/Desktop/flexunit4/bin/TestRunner.swf
                      OK: Policy file accepted: xmlsocket://127.0.0.1:1024
                      OK: Request for resource at xmlsocket://127.0.0.1:1024 by requestor from file:///home/<user>/Desktop/flexunit4/bin/TestRunner.swf is permitted due to policy file at xmlsocket://127.0.0.1:1024

                       

                      Running tests on my Mac I get the same results and output using FP v10 projector.

                       

                      As a precaution of the policy file not containing validation info, I've updated the policy file response to be the following:

                       

                      <?xml version="1.0"?>
                      <cross-domain-policy xmlns="http://localhost" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.adobe.com/xml/schemas PolicyFileSocket.xsd">

                         <allow-access-from domain="*" to-ports="1024" />
                      </cross-domain-policy>

                       

                      The patch should be avialable on the branch in a few days.

                       

                      I'll be honest, I'm not really sure why y'all are getting these errors.  You all may want to check and make sure that the Flash Player is getting closed correctly after it hangs.  You may also want to verify that your SWFs being passed to the task are using the latest CIListener class/swc from the FlexUnit4CIListener project.  Maybe a good first step would be giving the FlexUnit4SampleCIProject a go on your machines to see if it works as expected.  If you're using localTrusted=true, try double checking to make sure that the user running the CI process has rights to write to the /home/<user>/.macromedia/Flash_Player/#Security/FlashPlayerTrust/ directory, although I'd think this is a non-issue since it's in the user's home directory.

                       

                      Since we're still in the process of getting a headless version of the Ant task created, I can't help much with xvfb support since I don't know how y'all are using it (e.g - using xvfb-run or plain xvfb, using a fixed display # or automatically finding one, etc).  Our headless build will have lots of config options, so hopefully it'll help to simplfy the build process as well as help me debug issues you may run into using it.  If anyone would like to run down the specifics of how their environment is setup, how they're running things headlessly, etc in a separate thread I can try to address each individually to the best of my knowledge.  All I ask is that you're patient with me since I'm new to Linux.

                       

                      -Brian

                      • 8. Re: Building on headless linux
                        GavinCroy Level 1

                        Brain,

                         

                        Many thanks for looking into this. I'll spend some more time on this tomorrow. At least I know you've got it working in your environment, so there must be something awry in my approach. I'm not really a Linux expert either, although I have a fair amount of UNIX experience. I'm using Xvfb on a fixed display, and can run test harnesses etc in it and see their output logged in the trace console - it was just the policy stuff that was failing when trying to run via the CIListener. I'll also admit to not being an expert (yet ) in flash player policy stuff.

                         

                        To be fair, I was trying to run my own tests in my own projects etc rather than the turnkey project, so tomorrow I'll concentrate on using the stuff you guys provide straight from SVN and see if I can get that working before I muddy the waters with my own projects. I did start everything from scratch on Firday 18th September (downloading flash players onto Linux box, grabbing swcs/projects etc from your 4.x branch on SVN), so I should be using all the latest stuff.

                         

                        I'll report back on how I get on tomorrow evening (UK time).

                         

                        Cheers,

                        Gavin.

                        • 9. Re: Building on headless linux
                          GavinCroy Level 1

                          ok, I nearly went insane trying to get to the bottom of this!

                           

                          First up, I built the sample CI project from the latest version from SVN into my mac dev env withing Flex Builder. I copied this and the ant file to my linux machine and tried to run the test, this failed.

                           

                          So, I then checked out a copy of the project directly on my build server, build using ant, ran the tests and they worked.This proved that the CIListener and the ant task DO work in my linux env, I just had to figure out what the differences were in building the sample code and my own code.

                           

                          Since I'm using Antennae I was supicious of this. So I tried building my app using a 'vanilla' build file, i.e. a hacked version of the sample ant file. This worked!

                           

                          I then went back to trying to call the flexunit task from my antenna build file, back to failure! I then got my project building using my antennae build, but the tests running using the test target from the sample ant file, so I knew I was getting close!

                           

                          The short version of the story is that in my antennae build file I am using a fully qualified path (through properties) to specify the location of the swf file to the flexunit task. This causes a policy file problem. If I use a relative path to the swf file then it all works.

                           

                          So, it turned out to be something very very simple, isn't it always?

                           

                          I'm now going to go study my build files to work out if there are any gotchas in switching to relative paths when running the flexunit tasks, I'll report back on that when I'm done. Or perhaps the flexunit task should cater for both relative and absolute paths, I'm not sure. Either way, I can now continue my efforts to get my unit tests running on our headless server and reporting their output to Cruise Control.

                          • 10. Re: Building on headless linux
                            GavinCroy Level 1

                            An update on my previous comment, due to the fact that I am new to antennae I was using the wrong property to specify the swf in my call to flex unit target. D'oh.

                             

                            If I use the property which identifies the swf asset of the project I'm building as the argument to the flexunit task, then this works just fine. I've tested this from a build and test of the project in question, and a build of the parent project (which failed when I used relative paths to the swf, obviously).

                             

                            Anyway, all seems to be working great for me now!

                            • 11. Re: Building on headless linux
                              legrosb Level 3

                              @GavinCroy - Wow, good hunting man.  We are aware of issues launching swf's using absolute paths which contain spaces in the path (see README.txt file) so I'm glad it wasn't that; I would have definitely felt like I wasted your weekend   If you want to share some code samples with the list of quirks with your build process that hung you up, please do.  People can always benefit from the little things that eat our days.  Glad to hear things are working.

                               

                              @LeoBent - Have you had a chance to dig in any with the latest code base to see if it fixed your issues?  Maybe you could provide us with more information re: your environment?

                              • 12. Re: Building on headless linux
                                LeoBent Level 1

                                After I updated the CIListener and the flexunitanttask jar in my project, it stopped working locally on my Windows machine.

                                 

                                The libraries that are working best for me now are the ones located in the CI sample project. It seems to me that those libs haven't been updated with the latest code changes (both in the cilistner .swc and the flexunitanttask .jar). The cilistner is 21 KB in the ci sample project but the one located under the cilistener project is 15 kb. Maybe the whole flexunit svn repository needs to be updated a bit ?

                                 

                                 

                                To sum up:

                                 

                                By using the libs from the CI project:

                                 

                                - Windows

                                        My tests run. The testrunner opens and closes automatically  and reports are  generated

                                - Headless-Linux

                                        Gets to the following point and just hangs there:

                                                Creating local trusted file

                                                opened server socket

                                                accepting data from client

                                                start of test run

                                                sent policy file

                                 

                                 

                                By using newly build libs from SVN (both listner and ant tasks).

                                 

                                - Windows

                                        Testrunner opens and has to be manually closed. No reports generated.

                                - Headless-Linux

                                        Gets to the following point and then times out:

                                                Creating local trusted file

                                                opened server socket

                                 

                                 

                                I'll post info on my env. later today

                                • 13. Re: Building on headless linux
                                  GavinCroy Level 1

                                  Leo,

                                   

                                  The key to me figuring out why my app was 'hanging' at that output line was in the flash player log - are you getting any info in there? I use the following options in my mm.cfg file:

                                   

                                  ErrorReportingEnable=1
                                  TraceOutputFileEnable=1
                                  PolicyFileLog=1
                                  PolicyFileLogAppend=1
                                  • 14. Re: Building on headless linux
                                    ChrisFMR

                                    I to am having problems with headless linux build using FlexUnit4AntTasks. I am seeing some interesting things. I suspect that the FlashPlayer is either not executing my TestRunner.mxml, that the FlashPlayer is not communicating to the Flex Tasks, or something else. I have even modified the FlexUnit4AntTasks.jar to prove this.

                                     

                                    little background...

                                     

                                    I had to recomiple FlexUnit4AntTasks so that UnixFlashPlayerCommand.java could point to the flashplayer location of my choice because I did not have the luxury/access to install flash to /usr/bin or put a systemlink in place that points to the original gflashplayer.

                                     

                                    UnixFlashPlayerCommand.java changes...

                                    private static final String UNIX_CMD = "/app/team/flash9/flashplayer";

                                    I also added extra debug to FlexUnitSocketThread.java on the parseInboundMessages() method, because I suspected that the FlashPlayer was not sending any test result data back through the socket.

                                     

                                    FlexUnitSocketThread.java changes...

                                       private void parseInboundMessages() throws IOException
                                       {
                                           System.out.println("parseInboundMessages");
                                           String request = null;
                                         
                                          while ((request = server.readNextTokenFromSocket()) != null)
                                          {
                                              System.out.println("request="+request);
                                             
                                             // If the string is a failure, process the report
                                             if (request.endsWith(END_OF_FAILURE) || request.endsWith(END_OF_SUCCESS) || request.endsWith(END_OF_IGNORE))
                                             {
                                                processTestReport(request);
                                             }
                                             else
                                             {
                                                throw new BuildException("command [" + request + "] not understood");
                                             }
                                          }
                                       }

                                     

                                     

                                    /usr/X11R6/bin/Xvfb is running by default...

                                     

                                    I run the following


                                    export DISPLAY=:1.0

                                     

                                    I am running flash debugger player 9.

                                     

                                    my ant target is

                                     

                                    <flexunit swf="${bin.loc}/TestRunner.swf" toDir="${report.loc}" haltonfailure="false" verbose="true" localTrusted="true" headless="true"/>

                                     

                                    my ouput is as followed after running flexunit

                                     

                                        [mxmlc] /app/team/workspaces/flexcover/bin/TestRunner.swf (857376 bytes)

                                     

                                    launchFlashPlayer:
                                    [flexunit] Validating task attributes ...
                                    [flexunit] Generating default values ...
                                    [flexunit] Using default snapshot file path [/app/team/workspaces/flexcover/reports/snapshot.jpg]
                                    [flexunit] Using the following settings:
                                    [flexunit]     haltonfailure: [false]
                                    [flexunit]     headless: [true]
                                    [flexunit]     localTrusted: [true]
                                    [flexunit]     player: [flash]
                                    [flexunit]     port: [1024]
                                    [flexunit]     snapshot: [false]
                                    [flexunit]     snapshotFile: [/app/team/workspaces/flexcover/reports/snapshot.jpg]
                                    [flexunit]     swf: [/app/team/workspaces/flexcover/bin/TestRunner.swf]
                                    [flexunit]     timeout: [60000ms]
                                    [flexunit]     toDir: [/app/team/workspaces/flexcover/reports]
                                    [flexunit]     verbose: [true]
                                    [flexunit]     xcommand: [xvfb]
                                    [flexunit] Setting up server process ...
                                    [flexunit] OS: [Unix]
                                    [flexunit] Launching player:
                                    [flexunit] Executing '/app/team/flash9/flashplayer' with arguments:
                                    [flexunit] '/app/team/workspaces/flexcover/bin/TestRunner.swf'

                                     

                                    [flexunit] The ' characters around the executable and arguments are
                                    [flexunit] not part of the command.

                                     

                                    [flexunit] Created local trust file at [/export/home/team/.macromedia/Flash_Player/#Security/FlashPlayerTrust/flexUnit.cfg]
                                    [flexunit] Starting server ...
                                    [flexunit] Opening server socket on port [1024].
                                    [flexunit] Waiting for client connection ...
                                    [flexunit] Client connected.
                                    [flexunit] Setting inbound buffer size to [262144] bytes.
                                    [flexunit] Receiving data ...
                                    [flexunit] Sending acknowledgement to player to start sending test data ...

                                     

                                    [flexunit] parseInboundMessages

                                     

                                    [flexunit] Stopping server ...
                                    [flexunit] End of test data reached, sending acknowledgement to player ...

                                     

                                    BUILD FAILED
                                    /app/team/workspaces/build/build-flex-unit-coverage.xml:77:

                                    java.util.concurrent.ExecutionException: could not close client/server socket


                                    On my Windows box, the parseInboundMessages() will hit the while loop, and receive the XML test data response.

                                     

                                    On the headless linux box, I most always receive nothing back. I swear one time I originally got back report data, and another time I got back empty data in my report files. This was before I had any debug.

                                     

                                    I suspect that maybe depending when I run the ANT target, different ports are opened? Depending on the port, this may or may not work?

                                     

                                    The flash player must be running headless because I dont see any errors with respect to that, and the Java Input Stream is successfully opened?

                                     

                                    The reports directory just contains empty files that the JUNIT taks creates because there is no report data.

                                     

                                    Thoughts? I would love to get this working.

                                     

                                    I am trying to get EXCEED running so I can export a XTERM display to see what happens when the FlashPlayer launches on a remote window.

                                     

                                    Any help would be much appreciated.

                                    • 15. Re: Building on headless linux
                                      legrosb Level 3

                                      @ChrisFMR - Here are a couple suggestions that may help you debug.  Try using the debug standalone flash player for Linux with the mm.cfg file setup in the user's home directory set to write out debug logs.  If anything odd is happening on the Flash side of things, it will be under /export/home/team/.macromedia/Flash_Player/Logs.

                                       

                                      Since you feel comfortable building form source, you may also want to place debugging output in FlexUnitSocketServer#readNextTokenFromSocket outputting the value of buffer at the end of while loop to see if anything is being sent down by the Flash Player.  If you notice that an xml snippet related to a policy file is coming down, then the flexUnit.cfg file isn't being written to the correct location to create a trust relationship with the Flash Player.  It's also possible that the folder location doesn't exist or the file is empty; you may want to verify that the trust path exists and the file has the path to the directory containing your TestRunner SWF.  To rule this out, you may want to try using localTrusted="false" which will alter the Ant task to reply to the policy request and kick off your tests.  If this is the case, then this is a bug in the Ant task that we need to fix.

                                       

                                      I know the documentation for xvfb recommends using higher # displays, have you tried using a different display than 1.0?  Something may be timing out, but I'm not sure why it'd be unable to close the server.  The default port for the FP/Ant task communication is 1024, can you verify that that port is not in use, or that the ant process and FP process are dead once the build run is over?

                                       

                                      I know it's tripped me up a few times, so I'll throw out verifying flashplayer has exec rights, but I'm guessing you already checked that.  Is it possible to use Flash Player 10 in your setup?  If a lot of Linux users can't get gflashplayer symlink added to the path for the running user, then we could look at using an Ant property for the FP location.

                                       

                                      Hope this helps.  Maybe some of the other Linux users reading this could offer some more suggestions.

                                      • 16. Re: Building on headless linux
                                        ChrisFMR Level 1

                                        Thanks for the blazing fast response!!! It's 3:30AM EST here, hopefully it wasn't that late in your neck of the woods...

                                         

                                        I've got the following Flash Debug log...

                                         

                                        LocalConnectionCoverageAgent.initializeACKConnection: ackConnectionName null
                                        LocalConnectionCoverageAgent.addPendingMapAndAttempSend: 1
                                        LocalConnectionCoverageAgent.sendMaps: sent: 1 remaining:0
                                        Using method coverageDataAndExit
                                        LocalConnectionCoverageAgent.initializeACKConnection: ackConnectionName null
                                        LocalConnectionCoverageAgent.addPendingMapAndAttempSend: 1
                                        LocalConnectionCoverageAgent.sendMaps: sent: 1 remaining:0
                                        Using method coverageDataAndExit

                                         

                                        I've modified readNextTokenFromSocket() to look like:

                                         

                                           public String readNextTokenFromSocket() throws IOException
                                           {
                                              System.out.println("readNextTokenFromSocket start...");
                                               
                                              StringBuffer buffer = new StringBuffer();
                                              int piece = -1;

                                         

                                              while ((piece = inboundStream.read()) != NULL_BYTE)
                                              {
                                                 //Did we reach the end of the buffer?  Tell the user there is nothing more.
                                                 if (piece == -1)
                                                 {
                                                    return null;
                                                 }

                                         

                                                 final char chr = (char) piece;
                                                 buffer.append(chr);
                                                 System.out.println("readNextTokenFromSocket buffer:"+buffer);
                                              }

                                         

                                              //Did we recieve a message that the test run is over? Tell the user we have nothing more.
                                              String token = buffer.toString();
                                             
                                              if(token.equals(END_OF_TEST_RUN))
                                              {
                                                 return null;
                                              }
                                             
                                              return token;
                                           }

                                         

                                        Doesn't look like the inputstream is getting any response from Flash because only [flexunit] readNextTokenFromSocket start... is displayed...

                                         

                                        Here is my ANT log

                                         


                                        [flexunit] Created local trust file at [/export/home/team/.macromedia/Flash_Player/#Security/FlashPlayerTrust/flexUnit.cfg]
                                        [flexunit] Opening server socket on port [1024].
                                        [flexunit] Waiting for client connection ...
                                        [flexunit] Client connected.
                                        [flexunit] Setting inbound buffer size to [262144] bytes.
                                        [flexunit] Receiving data ...
                                        [flexunit] Sending acknowledgement to player to start sending test data ...

                                         

                                        [flexunit] parseInboundMessages
                                        [flexunit] readNextTokenFromSocket start...

                                         

                                        [flexunit] Stopping server ...
                                        [flexunit] End of test data reached, sending acknowledgement to player ...

                                         

                                        on another note, I changed  localTrusted="false"

                                         

                                        and this is my log...

                                         


                                        [flexunit] Deleted existing local trust file at [/export/home/team/.macromedia/Flash_Player/#Security/FlashPlayerTrust/flexUnit.cfg].
                                        [flexunit] Opening server socket on port [1024].
                                        [flexunit] Waiting for client connection ...

                                         

                                        and it just hangs for a minute and then I get

                                         

                                        [flexunit] Stopping server ...
                                        [flexunit] End of test data reached, sending acknowledgement to player ...
                                        [flexunit] Closing client connection ...
                                        [flexunit] Closing server on port [1024] ...

                                         

                                        BUILD FAILED
                                        /app/team/workspaces/build/build-flex-unit-coverage.xml:77: java.util.concurrent.ExecutionException: Socket timeout waiting for flexunit report

                                         

                                        If I attempt to change the display on xvfb I get an error like...

                                         

                                        team > export DISPLAY=:10.0
                                        team > /usr/X11R6/bin/Xvfb :10 -screen 0 1280x1024x8 &
                                        [1] 4584
                                        team > _XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
                                        _XSERVTransOpen: transport open failed for inet6/lrtp94:10
                                        _XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6
                                        _XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
                                        Could not init font path element /usr/X11R6/lib/X11/fonts/TTF/, removing from list!
                                        Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
                                        Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
                                        Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!

                                         

                                        Seems like the issue is with FLASH not kicking off the TestRunner properly because no data is being sent? Although, like I said, only once I got results... and I can no longer get them. I got them once before leaving for the day earlier this week, thought I had this CI wrapped, then the following day realized I no longer could get the results, and here I am...

                                         

                                        Thanks so much for your help!

                                         

                                        Chris

                                        • 17. Re: Building on headless linux
                                          legrosb Level 3

                                          @ChrisFMR - I was thinking a little higher than 10 on xvfb, maybe try 99.  I know that's where xvfb-run starts when it picks a display #.

                                           

                                          You want to consider looking into using xvnc or, if you're running Hudson, using the xvnc plug-in.  It's pretty easy to setup and once it's done you can vnc into the display and find out if the flash player launched and what it's showing.  Are you seeing the FP listed as a running process when the Ant script says it kicks off the flexunit Ant task?

                                           

                                          From your output it looks like the Flash Movie isn't sending anything where a policy file is requested or not.  It looks like you're running FlexCover as well, did you check to see if there was a port conflict on 1024 or if anything else was using 1024?  From the little I've worked with FlexCover I don't think is the case, but best to explore all options.

                                           

                                          Would you mind pasting the Ant target(s) (or build script) you're using to compile your tests and run them?  This would help me get a bigger picture of what's going on.  If you could paste the code from your TestRunner.mxml as well it'd help.  That way we can rule out setup as well.

                                           

                                          -Brian

                                          • 18. Re: Building on headless linux
                                            ChrisFMR Level 1

                                            Wow, you just made me realize my problem.

                                             

                                            My ANT script and my TestRunner are attached...

                                             

                                            ANT wasn't launching FlexCover but the TestRunner was trying to flush the coverage reports.

                                             

                                            Once I commented //com.allurent.coverage.runtime.CoverageManager.exit(); in the TestRunner, I was able to get the following

                                             

                                            a/Developer/personalProjects/flexUnit/FlexUnit/src/flexunit/framework/ProtectedMiddleTestC ase.as:47]
                                            [flexunit]     at flexunit.framework::TestResult/doProtected()[/Users/xasegura/Developer/personalProjects/f lexUnit/FlexUnit/src/flexunit/framework/TestResult.as:239]
                                            [flexunit]     at flexunit.framework::TestResult/doContinue()[/Users/xasegura/Developer/personalProjects/fl exUnit/FlexUnit/src/flexunit/framework/TestResult.as:104]
                                            [flexunit]     at flexunit.framework::TestResult/doRun()[/Users/xasegura/Developer/personalProjects/flexUni t/FlexUnit/src/flexunit/framework/TestResult.as:90]
                                            [flexunit]     at flexunit.framework::TestResult/run()[/Users/xasegura/Developer/personalProjects/flexUnit/ FlexUnit/src/flexunit/framework/TestResult.as:65]
                                            [flexunit]     at flexunit.framework::TestCase/runWithResult()[/Users/xasegura/Developer/personalProjects/f lexUnit/FlexUnit/src/flexunit/framework/TestCase.as:165]
                                            [flexunit]     at flexunit.framework::TestSuite/runTest()[/Users/xasegura/Developer/personalProjects/flexUn it/FlexUnit/src/flexunit/framework/TestSuite.as:186]
                                            [flexunit]     at flexunit.framework::TestSuite/runNext()[/Users/xasegura/Developer/personalProjects/flexUn it/FlexUnit/src/flexunit/framework/TestSuite.as:174]
                                            [flexunit]     at flexunit.framework::TestSuiteTestListener/handleTimer()[/Users/xasegura/Developer/persona lProjects/flexUnit/FlexUnit/src/flexunit/framework/TestSuiteTestListener.as:74]
                                            [flexunit]     at flash.utils::Timer/_timerDispatch()
                                            [flexunit]     at flash.utils::Timer/tick()</stackTraceInfo></failure></testcase>
                                            [flexunit] FlexUnit test testStripAmountFailure in suite components.common.UtilityTest failed.
                                            [flexunit] readNextTokenFromSocket start...
                                            [flexunit] readNextTokenFromSocket buffer:<
                                            [flexunit] readNextTokenFromSocket buffer:<e
                                            [flexunit] readNextTokenFromSocket buffer:<en
                                            [flexunit] readNextTokenFromSocket buffer:<end
                                            [flexunit] readNextTokenFromSocket buffer:<endO
                                            [flexunit] readNextTokenFromSocket buffer:<endOf
                                            [flexunit] readNextTokenFromSocket buffer:<endOfT
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTe
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTes
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTest
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTestR
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTestRu
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTestRun
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTestRun/
                                            [flexunit] readNextTokenFromSocket buffer:<endOfTestRun/>

                                             

                                            [flexunit] Stopping server ...
                                            [flexunit] End of test data reached, sending acknowledgement to player ...
                                            [flexunit] Closing client connection ...
                                            [flexunit] Closing server on port [1024] ...

                                             

                                            I wonder if there is an issue closing the server??? The reports are there now...

                                             

                                            I had FlexCover partially commented (well partially) because I dont think this linux box had all the dependent libraries to run FlexCover. I totally forgot about the TestRunner though, thanks for making me realize....

                                             

                                            Thoughts on closing the server?

                                             

                                            I should be in good shape now!

                                             

                                            Thanks so much!!!

                                            • 19. Re: Building on headless linux
                                              ChrisFMR Level 1

                                              I could probably add a runtime exec line to kill the flashplayer?

                                              • 20. Re: Building on headless linux
                                                legrosb Level 3

                                                @ChrisFMR - This would be a great opportunity for someone to try/test the FlexCoverListener I created in the latest version of the FlexUnit4CIListener project (http://github.com/flexunit/flexunit/tree/master/FlexUnit4CIListener/src/org/flexunit/liste ners/).  It will close the CoverageViewer and the FP for you.  Just switch out the CIListener in your project with FlexCoverCIListener using artifacts built from source on GitHub:

                                                 

                                                   http://github.com/flexunit/flexunit

                                                 

                                                It works great for me on our FU4 Hudson builds, so hopefully it'll work out for you too.  To see an example of how we're using it, check out:

                                                 

                                                   http://github.com/flexunit/flexunit/blob/master/FlexUnit4Test/src/InstrumentTestRunner.mxm l

                                                   http://github.com/flexunit/flexunit/blob/master/FlexUnit4Test/build.xml

                                                 

                                                I also wrote a XSLT to covert a CVR file to a cobertura compatible XML file for CI server use.  You can find it here:

                                                 

                                                   http://github.com/flexunit/flexunit/blob/master/FlexUnit4Test/fc-to-cobertura.xsl

                                                 

                                                Hope this helps.  Glad we were able to find the problem.

                                                 

                                                -Brian

                                                • 21. Re: Building on headless linux
                                                  ChrisFMR Level 1

                                                  Ideally I would love to get FlexCover on running on this headless linux machine. We have an IBM RTC setup, with ANT/Maven running within RTC for our CI builds. So the ANT script that I attached above will just tie into that process.

                                                   

                                                  However FlexCover may not be an option, at least I don't think it will. Correct me if I am wrong, I will need Adobe AIR and CoverageViewer running on the headless linux machine?

                                                   

                                                  I am missing required libraries for AIR...

                                                   


                                                  team > ./AdobeAIRInstaller.bin
                                                  Error loading the runtime (libxml2.so.2: cannot open shared object file: No such file or directory)
                                                  team >

                                                   

                                                  Thoughts?

                                                   

                                                  Thanks,

                                                  Chris

                                                  • 22. Re: Building on headless linux
                                                    legrosb Level 3

                                                    @ChrisFMR - Sorry for the late reply; still catching up on emails upon my return from vacation.  To run FlexCover you will need to have the AIR runtime for Linux installed along with the FlexCover CoverageViewer applicaiton which is AIR-based.  The same rules necessary to execute the Flash Player headlessly on Linux would apply to running the CoverageViewer (basically redirecting windowing output to a different display under X-Win).  With respect to your AIR installation question, I'm not 100% on this, but looks like a libxml2 is a dependency of AIR for your distro, so you'll probably have to have it installed prior to installing the AIR runtime.  I also have read that 64-bit distro's aren't officially supported by Adobe, but they have some suggestions on getting it working @ http://kb2.adobe.com/cps/408/kb408084.html.  You may also want to check out that link for a list of dependencies to see if that helps any.  You could also hit up the FlexCover mailing list for suggestions @ http://groups.google.com/group/flexcover-discussion.

                                                     

                                                    Best of luck.

                                                     

                                                    -Brian