Archive

Posts Tagged ‘open source’

Statement Code Coverage Testing – Part 2

November 26, 2011 1 comment

Back in November 2009 I posted the “UniBasic Code Coverage” project as an open-source project. Back then it was stripped version based on one I set up for my then employer. The version for my employer used an in-house pre-processor that greatly simplified the work I needed to do for it work with our source files.

I have now released the v0.2 (update: v0.8) development version which has fixed several bugs, added the ability to specific a customer pre-process for those don’t use string UniBasic and provided improved the documentation on installing, using and contributing.

As you will already be aware, the source code for this is hosting on the UniBasic Code Coverage Project at SourceForge in a Subversion repository. If you have Subversion installed, you can checkout the code with the following command:


svn co https://ucov.svn.sourceforge.net/svnroot/ucov ucov

If you are running UniData or UniVerse on Windows, I highly recommend you install Tortoise SVN as it greatly simplifies working with Subversion.

On the SourceForge site you will not only find the Subversion repository for all the code, but also ‘Tracker’ which will allow you to submit Feature and Bug tickets. If you need help with anything, you can submit a Support Request as well.

If you wish to contribute to the code or documentation, you can introduce yourself on the Developer Forum. The best way to submit code or doc is by generating a Diff of the changes, as well as what the behaviour was before the change and what it was after the change.

When you have used UBC, be sure to fill out a Review. All constructive input is welcome and appreciated!

Making Life Easier

Every developer worth their salt has little snippets of code that they use to make their life easier.

So today, I thought I’d share a little utility that I use all the time.

Readers, meet RL. RL, meet readers. RL (Run Line) allows you to run a single line of code to see what it does. Typically, I use this as a quick way to check out an OCONV express I haven’t used in a while or as a calc replacement if I don’t feel like tabbing out of the terminal. All you need to do is compile and catalog to enjoy its simpleness. RL supports 1 option, ‘-H’. This option allows you hide the compiler output if you wish.

To use RL, you can either enter the code as part of the command line arguments, or you can enter it as an input. Here is a screenshot of RL in action:

RL Utility

RL Utility

 

Disclaimer: I strongly recommend against implementing this on a production machine as it will allow arbitrary code execution. This code has only been tested on UniData 7.2.x. Feel free to use this code however you want. If you somehow turn this in to something profitable share the love and either buy me a beer or make a donation to an open source project.

Okay, so enough with the spiel. Here’s the code :
(Updated 2011-06-02 due to ‘<-1>’ being stripped)


 

EQU TempDir TO "_PH_"
EQU TempProg TO "SNIPPET"

OPEN TempDir TO FH.TempDir ELSE STOP "ERROR: Unable to open {":TempDir:"}"

* Determine if we should hide compiler output
* Also determine the start of any command line 'code'

IF FIELD(@SENTENCE, " ", 2) = "-H" THEN
   HideFlag = @TRUE
   CodeStart = COL2() + 1
END ELSE
   CodeStart = COL1()
   IF CodeStart = 0 THEN
      CodeStart = LEN(@SENTENCE) + 1 ;* Force it to the end
   END ELSE
      CodeStart += 1 ;* Skip the Space
   END

   HideFlag = @FALSE
END

* Get the code from the command line arguments, or
* Get the code from stdin

IF CodeStart <= LEN(@SENTENCE) THEN
   Code = @SENTENCE[CodeStart, LEN(@SENTENCE) - CodeStart + 1]
   Code = TRIM(Code, " ", "B")
END ELSE
   PROMPT ''
   CRT "Enter Code: ":
   INPUT Code
END

* Compile, catalog and run the program
* We only catalog it so that @SENTENCE behaves as you would expect

WRITEU Code TO FH.TempDir, TempProg ON ERROR STOP "ERROR: Unable to write {":TempProg:"}"

Statement = "BASIC ":TempDir:" ":TempProg
Statement<-1> = "CATALOG ":TempDir:" ":TempProg:" FORCE"

IF HideFlag THEN
   EXECUTE Statement CAPTURING Output RETURNING Errors
END ELSE
   EXECUTE Statement
END

EXECUTE TempProg

* Clean up time

DecatStatement = "DELETE.CATALOG ":TempProg
EXECUTE DecatStatement CAPTURING Output RETURNING Errors

DELETE FH.TempDir, "_"TempProg
DELETE FH.TempDir, TempProg

STOP

Open Source: Some Positive News

August 12, 2010 Leave a comment

In case you haven’t noticed, open source has exploded into the mainstream and the profitable band-wagon that has built up revolves around “setup & support”, “customisation” and “enhanced enterprise editions”.

Yes, a lot of those companies do not solely handle FOSS projects, but it is a valuable part of their business.

The best part of FOSS is that because it is free and readily available, the potential people who will be exposed to the product is greatly increased. With MV-style databases largely unknown (and not understood), having more people aware of the technology can only improve the scene for us that work with it. The more companies using it means more jobs. Who can argue that against that?

That’s why Brian Leach’s announcement at the end of July is such a positive step for the community at large.

mvScan was originally a tool that I had developed for my use, to document a UniVerse system by iterating through the account and file structures, building impact maps and filling out tables with information culled from the entries found to make it easier for someone to search through their system.

So I’ve decided the best way forward is for me to open it up. That way, people who want to run it on their systems can do so and feed back any updates and changes that result from applying it to their specific structure and code organization.

So watch this space for announcements. If this goes well, there’s plenty of other stuff I want to open source.

You can read more on mvScan at Brian’s site.

I don’t know about you, but I’m looking forward to the release.

Statement Code Coverage Testing

November 27, 2009 1 comment

On the right-hand side you will see a link to the “Unibasic Code Coverage” project on sourceforge. This tool will enable you to perform statement level code coverage tests on UniData code. The results are then tabulated and saved as a colour coded HTML file.

This is based on the original prototype I wrote before further developing it for my current employer. Although this open source version is relatively simplistic, I will be progressing it by back-porting features as well as trialling new ideas.

If you try it out, leave a comment or send me an email and let me know how it went. If you are interested in helping with the development of it, or making the minor changes needed to port it to UniVerse then get in touch!


%d bloggers like this: