~ubuntu-branches/ubuntu/jaunty/psi/jaunty

« back to all changes in this revision

Viewing changes to unittest/update.rb

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env ruby
2
 
# This script is used to update auto-generated 
3
 
# files named 'checkall' and 'unittest.pro'.
4
 
 
5
 
# get list of path names
6
 
tests = File.new('tests.txt').readlines.find_all { |i| i =~ /^[^#]/ }.collect { |i| i.chomp }
7
 
 
8
 
# this string is used to indicate the file is auto-generated
9
 
WARNING = "WARNING! All changes made in this file will be lost!"
10
 
 
11
 
# generate 'checkall' script
12
 
File::open('checkall', 'w') do |f|
13
 
  f << "#!/bin/bash\n"
14
 
  f << "# #{WARNING}\n"
15
 
  f << "basedir=`pwd`\n"
16
 
  f << "do_make() {\n"
17
 
  f << "  if test ! -e Makefile; then qmake; fi\n"
18
 
  f << "  make check\n"
19
 
  f << "}\n"
20
 
  f << tests.collect { |dir| "cd #{dir} && do_make && cd $basedir" }.join(" && \\\n") + "\n"
21
 
end
22
 
 
23
 
# generate project file
24
 
File::open('unittest.pro', 'w') do |f|
25
 
  f << "# #{WARNING}\n"
26
 
  f << "TEMPLATE = subdirs\n\n"
27
 
  f << "SUBDIRS += \\\n"
28
 
  f << tests.collect { |dir| "\t#{dir}" }.join(" \\\n") + "\n"
29
 
  f << "\n"
30
 
  f << "QMAKE_EXTRA_TARGETS += check\n"
31
 
  f << "check.commands = sh ./checkall\n"
32
 
end