Thread

  1. Re: Environment checks prior to regression tests?

    Kohei KaiGai <kaigai@kaigai.gr.jp> — 2011-07-25T08:36:38Z

    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@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@iwashi sepgsql]$
    
    Then, we can turn on it according to the suggestion.
    
    [kaigai@iwashi sepgsql]$ su -
    Password:
    [root@iwashi ~]# setsebool sepgsql_regression_test_mode 1
    [root@iwashi ~]# logout
    [kaigai@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@joeconway.com>:
    > On 07/21/2011 05:35 AM, Robert Haas wrote:
    >> On Thu, Jul 21, 2011 at 6:16 AM, Kohei Kaigai <Kohei.Kaigai@emea.nec.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@postgresql.org)
    > To make changes to your subscription:
    > http://www.postgresql.org/mailpref/pgsql-hackers
    >
    
    
    
    -- 
    KaiGai Kohei <kaigai@kaigai.gr.jp>