Dariusz on Software Quality

21/12/2010

Sendmail in chroot-ed environment for CI purposes

Filed under: en — Tags: , — dariusz.cieslak @

Recently I’ve been working on simple continuous integration tool that builds fresh checkouts from Perforce and uploads binary artifacts to external FTP server for testing purposes. I’m using chrooted Debian Squeeze 32 bit environment inside 64 bit host based on RPM distro (basic chroot, a simpler form of BSD’s chroot jail).

The frequent problem was failing builds caused by partial commits from different teams (client was not comfortable with shared codebase ownership idea). We decided to replace rule “before every commit check if all suite is building” to “minimize failed build time as possible”.  How to minize the problem if it cannot be avoided at all?

(more…)

20/12/2010

Backtraces for C++

Filed under: en — Tags: , , , — dariusz.cieslak @

Java does it pretty well. C++ sucks by default. What is that?: The answer: Backtraces.

Sometimes assert information (file name and line number where assertion occured is not enough to guess where the problem is. It’s useful to see the backtrace (stack trace in Java vocabulary) of calling methods/functions. You can achieve that in C++ using gdb (and analysing generated core files or run the program under debugger), but it’s not a “light” (and elegant) solution.

I’m presenting here a method to collect as meaningful backtraces in C++ as possible. Just link to module below and you will see pretty backtraces on abort/assert/uncaught throw/…

(more…)

10/12/2010

Chrooting 32-bit Debian

Filed under: en — Tags: , — dariusz.cieslak @

Sometimes brand-new 64 bit architecture must be used for running 32-bit programs. You can preserve your 64-bit system and create so called “32 bit chroot” environment. I’ll use Debian as guest operating system because it supports easy bootstrapping out-of-the-box.

I assume debootstrap program is already installed. First: create Debian tree:

# debootstrap --arch=i386 lenny /home/dccb/lenny

Then we can chroot to new env and customize:

# chroot /home/dccb/lenny /usr/bin/i386
(...)

Note that shell “/usr/bin/i386″ is required for chrooted environment to see 32-bit architecture. If you want to jump directly into plain user account use this command:

# chroot /home/dccb/lenny /usr/bin/i386 su - $CHROOT_USER

Inside chroot you can do (almost) everything (install programs, run daemons, …). Note that sometimes you will have to change services ports to not collide with services present on host (HTTP, SSH, …) – it’s not a virtualisation, just chroot jail.

Additional note: In order to get correct /dev and /proc tree you have to mount them before chrootting:

mount -o bind /proc /home/dccb/lenny/proc
mount -o bind /dev /home/dccb/lenny/dev

05/12/2010

Logs on X background

Filed under: en — Tags: , — dariusz.cieslak @

Do you want to easily control different events that may occure in your system? Are you boring of looking into log files (or do you reviewing them regularly?). Here’s simple method how to not miss any interesting event! Place logs on X server root!

As you can see you can mix logs from many sources. It’s “tail -f” ported to X server. Here’s command line invocation I placed in ~/.xinitrc:

root-tail -color white -font "-misc-*-*-r-*-*-10-*-*-*-*-*-*-*"\
        -g 2020x350+1-10 \
        --outline --minspace \
        ~/procmail.log \
        /var/log/messages \
        /var/log/daemon.log \
        /var/log/syslog \
        ~/.xsession-errors \
        &

Pretty useful small pgm. Enjoy!

Powered by WordPress