Re: Environment checks prior to regression tests?

From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Joe Conway <mail(at)joeconway(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Kohei Kaigai <Kohei(dot)Kaigai(at)emea(dot)nec(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Environment checks prior to regression tests?
Date: 2011-07-25 08:36:38
Message-ID: CADyhKSXQpfvj0zk6ZXYspQnzyHBZJMyk8r763p-KhPAtRc=X3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The attached patch enables to check prerequisites to run regression
test of sepgsql module.
It adds a dependency to installcheck that allows us to launch
a script to check environment of operating system.
I'd like to add this patch next commit-fest.

E.g, this example does not turn on sepgsql_regression_test_mode
boolean parameter of selinux.

[kaigai(at)iwashi sepgsql]$ make installcheck
:
============== checking selinux environment ==============
test unconfined_t domain ... ok
test runon command ... ok
test sestatus command ... ok
test getsebool command ... ok
test enforcing mode ... ok
test sepgsql-regtest policy ... ok
test selinux boolean ... failed

The boolean variable of 'sepgsql_regression_test_mode' must be
turned. It affects an internal state of SELinux policy, then
a set of rules to run regression test will be activated.
You can turn on this variable as follows:

$ su -
# setsebool sepgsql_regression_test_mode 1

Also note that we recommend to turn off this variable after the
regression test, because it activates unnecessary rules.

make: *** [check_selinux_environment] Error 1
[kaigai(at)iwashi sepgsql]$

Then, we can turn on it according to the suggestion.

[kaigai(at)iwashi sepgsql]$ su -
Password:
[root(at)iwashi ~]# setsebool sepgsql_regression_test_mode 1
[root(at)iwashi ~]# logout
[kaigai(at)iwashi sepgsql]$ make installcheck
:
============== checking selinux environment ==============
test unconfined_t domain ... ok
test runon command ... ok
test sestatus command ... ok
test getsebool command ... ok
test enforcing mode ... ok
test sepgsql-regtest policy ... ok
test selinux boolean ... ok
test label of psql ... ok
test sepgsql installation ... ok
test template1 database ... ok

../../src/test/regress/pg_regress --inputdir=.
--psqldir='/usr/local/pgsql/bin' --dbname=contrib_regression
--launcher ../../contrib/sepgsql/launcher label dml misc
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries ==============
test label ... ok
test dml ... ok
test misc ... ok

=====================
All 3 tests passed.
=====================

Thanks,

2011/7/22 Joe Conway <mail(at)joeconway(dot)com>:
> On 07/21/2011 05:35 AM, Robert Haas wrote:
>> On Thu, Jul 21, 2011 at 6:16 AM, Kohei Kaigai <Kohei(dot)Kaigai(at)emea(dot)nec(dot)com> wrote:
>>> How about an idea that allows to launch environment checker (typically shell scripts) prior
>>> to regression tests?
>>>
>>> The following stuffs should be preconfigured to run sepgsql's regression test.
>>> - SELinux must be run and configured to enforcing mode.
>>> - The sepgsql-regtest policy module must be loaded.
>>> - The boolean of sepgsql_regression_test_mode must be turned on.
>>> - The psql command should be labeled as 'bin_t'
>>>
>>> If checkinstall optionally allows to launch an environment checker on regression test,
>>> we may be possible to suggest users to fix up their configuration. It seems to me quite
>>> helpful.
>>>
>>> For example, one idea is to inject a dummy variable (mostly, initialized to empty) as
>>> dependency of installcheck, being available to overwrite in Makefile of contrib, as follows:
>>>
>>>  # against installed postmaster
>>>  installcheck: submake $(REGRESS_PRE)
>>>          $(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
>>
>> Seems reasonable.
>
> +1
> it would have been helpful to me last month while looking at this.
>
> Joe
>
> --
> Joe Conway
> credativ LLC: http://www.credativ.us
> Linux, PostgreSQL, and general Open Source
> Training, Service, Consulting, & 24x7 Support
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

--
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

Attachment Content-Type Size
pgsql-v9.2-check-regtest-environment.patch application/octet-stream 9.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2011-07-25 08:37:54 Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON
Previous Message Martin Pihlak 2011-07-25 07:33:29 Re: libpq SSL with non-blocking sockets