Re: Environment checks prior to regression tests?

Lists: pgsql-hackers
From: Kohei Kaigai <Kohei(dot)Kaigai(at)EMEA(dot)NEC(dot)COM>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Environment checks prior to regression tests?
Date: 2011-07-21 10:16:06
Message-ID: D0C1A1F8BF513F469926E6C71461D9EC01E341@EX10MBX02.EU.NEC.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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)

Thanks,
--
NEC Europe Ltd, SAP Global Competence Center
KaiGai Kohei <kohei(dot)kaigai(at)emea(dot)nec(dot)com>


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kohei Kaigai <Kohei(dot)Kaigai(at)emea(dot)nec(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Environment checks prior to regression tests?
Date: 2011-07-21 12:35:40
Message-ID: CA+TgmoY2dWpZzTDXJDBy9pQSyd+mSCin8A8fUGWC8Mgtv=rmcA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Joe Conway <mail(at)joeconway(dot)com>
To: 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-22 15:42:23
Message-ID: 4E299A5F.2050403@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


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
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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: Joe Conway <mail(at)joeconway(dot)com>, 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 14:51:53
Message-ID: CA+Tgmoa8ukTjChObC4cmBOReGjauy14kYMbkGn1B8+tdkbbuLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Jul 25, 2011 at 4:36 AM, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> wrote:
> 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.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company