Automating build and test process

Hey ppl,

            I've been asked to automate the build and test process for my team at office.we work on Linux and use Perforce for SCM. I've just joined this company and dont have much knowledge on unix scripts. Could someone tell me how to go about doing this?:confused:

You can post the steps that you need to carry out there...,then we got lot of helping hands who would help us. (list what you would be doing manually to accomplish your tasks.)

Beleive me, i really learn many things from there posts; they really deserve a *million* thanks!!

-ilan

You can use makefiles, ant scripts or shell scripts for your build process. You haven't told us about the source files. Are they c/c++, java or something else ?

If they are java source files, then you are better off with ant scripts. The same ant script can be in used in Windows and Linux. If the source files are c/c++, then makefiles are the best. But the makefiles would differ for Windows and Linux.

Shell scripts work well on Linux. But to make them work on Windows you would need the MKS Toolkit or Cygwin.

For automating your test process, I believe you would have some existing test cases. If it is a testsuite, then you can use a framework similiar to JUnit. If they are unit test cases, then shell scripts or makefiles would be good.

Thanks for the reply ilan and vino.. :slight_smile:

The source files are in C and each user runs unit test cases..

How will i be able to schedule the builds for each user?? and could u tell me how exactly to automate the test process?

These are some of the requirements...

  • Automatically start build process and it's tests at desired time.
  • Option for manual build invocation
  • One build process at a time (The build process shall not be started for the second time before it is over).
  • Write log file with all console messages.
  • email notifications

For all these 3 requirements, there had been numerous number of posts discussing the same in different context

for ex:
1 build at a time -> process control. check for previous instance before instantiating a new instance
log file -> log file naming and redirecting output / debug / error messages to log file
email notifications -> sending email using mail / mailx. Sending file as inline attachment. Sending attachment with body

Please use the search facility, am sure you would find many such threads.

Use a cron job. Search the forum with the key words 'cron job'

You need to take care of this before you consider the cron jobs. The trigger for the build should be a simple script/makefile with the option of Release/Debug builds. This script/makefile may recursively go into each sub-directory and call other makefiles/scripts. Consider it like this.

Parent makefile/script
|
|-- Invoke dir1/makefile
|-- Invoke dir2/makefile
|-- Invoke dir3/makefile

Are you concerned that the cron job and the manual build will overlap ? If so, when the build starts, create an empty file to indicate that the build has started. When the build fails/end remove that file. Check for the presence of that file to decide whether to start the build or not.

Redirect all output to some log file. You need to take care of this in your parent makefile/script.

Once all the build is done, collect reports of build success/failure and attach it to the mail and send it to the concerned people. Search the forum with the keywords 'email notification'.

Thank you so much for ur help, Vino! :slight_smile: