Commit Graph

207 Commits

Author SHA1 Message Date
Panu Matilainen aea6f0423f Execute all non-compilation rpmbuild tests in fakechroot
- Except for four rpmbuild tests which rely on an actual compiler
  being available (faking *that* would get entertaining...), the entire
  test-suite is now executing everything in the fakechroot environment.
2011-04-04 14:05:17 +03:00
Panu Matilainen 8e34f32f9f Add more stuff to test-suite root environment
- Build needs a whole bunch of utilities there, including file + its
  magic database. The exact location of the magic db varies between
  systems but file -C lets us basically make a copy of the system magicdb
  into the fakechroot env and then we can override the location with MAGIC
2011-04-04 14:00:23 +03:00
Panu Matilainen cb4da93fdf Switch more test-suite builds to run under fakechroot
- This leaves only the "real" builds where the packages contain files
  to be executed outside fakechroot
2011-04-04 12:13:56 +03:00
Panu Matilainen f439f4fc8a Run dependency tests entirely in fakechroot
- All the packages here have no files making them "easy" to build
  inside the chroot
2011-04-04 12:03:38 +03:00
Panu Matilainen 086791164a Prepare the test root entirely from Makefile, add missing bits
- Running builds in fakechroot needs a whole lot of things.. add symlinks
  to various system config + dev files to give some trivial packages
  a chance to build under fakechroot
2011-04-04 12:01:43 +03:00
Panu Matilainen 72b21d5ffc Remove redundant data copying into test-suite root 2011-04-04 11:39:25 +03:00
Panu Matilainen 1743c9eba9 Avoid leaking our compilation directory into test-suite
- Since they're running in fakechroot there's no need to arrange
  user writable directories this way
2011-04-04 11:27:03 +03:00
Panu Matilainen 27e8417cf3 Adjust rpmdb path for all remaining non-fakeroot runs
- Executing rpmbuild in the fakeroot gets fairly tricky, especially
  for the tests that actually compile things. Overriding the dbpath
  prevents it from accessing system rpmdb for keyring and build-requires.
- With this patch, the test-suite now passes the smoke-test of
  "chmod go-rx /var/lib/rpm" on system rpmdb.
2011-04-01 17:50:08 +03:00
Panu Matilainen 500c6a13ea Adjust rpmdb path in python tests
- We can't run python easily in the chroot so override the dbpath
  to our test area instead of potentially accessing the system db
  for keyring etc
2011-04-01 17:44:35 +03:00
Panu Matilainen f5b288fef6 Explicitly initialize the test-root database always
- Otherwise various places will be emitting "generating xx missing indexes"
  warnings, we dont want that noise in the test-suite results
2011-04-01 17:43:13 +03:00
Panu Matilainen b96a9130ac Switch the two remaining rpm runs under fakechroot
- Everything in the test-suite except rpmbuild execution is now
  performed in the fakechroot environment
2011-04-01 17:18:46 +03:00
Panu Matilainen ac99b7c7e8 Run all rpmmacro tests under fakechroot 2011-04-01 17:07:52 +03:00
Panu Matilainen 9e4b0b3bfb Make a bunch of tools available in the testsuite root environment
- We'll need shell and various other bits in order to do many
  things wrt specs and builds in the root...
2011-04-01 17:06:42 +03:00
Panu Matilainen 1f2dd7313c Run most rpmi tests under fakechroot
- one of the manifest tests is failing mysteriously in root mode though..
2011-04-01 16:20:48 +03:00
Panu Matilainen ce23b96ba7 Run testsuite rpmdb init helper with fakechroot 2011-04-01 16:18:26 +03:00
Panu Matilainen a3dc8a9209 Make all query tests run under fakechroot 2011-04-01 15:42:47 +03:00
Panu Matilainen 0bc3ae3b71 Make all generic tests run under fakechroot 2011-04-01 15:42:30 +03:00
Panu Matilainen a6ac17aec3 Avoid unnecessary use of 'id' in test-suite specs
- We could just ditch the entire buildroot lines from the specs
  but leaving one case to test that we dont actually fail on specs
  that do have it.
2011-04-01 15:39:21 +03:00
Panu Matilainen b2032ed776 Make all test data available in the test-root 2011-04-01 15:29:52 +03:00
Panu Matilainen 75a9c49e64 Test-suite spring cleaning
- Remove duplicate --version checks (doh) and some commented out
  build tests that are unlikely to ever be implemented in reality
2011-04-01 14:44:42 +03:00
Michael Schroeder 82347dc881 Fix corner-case behavior on dependency matching when release not present
- The idea behind the patch is that a missing release is handled
  as "all/any release". Nothing changes for "foo < 1.2" or
  "foo > 1.2", it still just compares the version. But "foo = 1.2"
  means "everything with version 1.2". Thus, any match against
  a package with version "1.2" a any non-empty release must
  return true.
- Update test-suite expectations to the new behavior.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2011-02-15 14:55:55 +02:00
Panu Matilainen b76fa1a7fd Require %files section for package generation again
- Turns out this change does more harm than good, people are actually
  relying on this behavior to avoid zillion conditionals in the spec.
  We'll want a saner way to conditionally disable/enable packages
  but until we have that, revert to the former longstanding behavior.
- This effectively reverts commit d010ec1c90
2010-12-23 09:24:25 +02:00
Panu Matilainen c91e00e81e Yet another pile of depmatch tests + added commentary 2010-12-17 11:00:41 +02:00
Panu Matilainen 1f037a030a Add pile of further dependency match testcases
- Test for provide ranges, versionless dependencies and different names
- Tabify the test-table for readability + editability
2010-12-17 09:19:48 +02:00
Panu Matilainen 2c4899c8d7 Add a pile of dependency matching tests for "obvious" cases 2010-12-16 17:39:00 +02:00
Panu Matilainen 8acb7f7c1d Move python test-suite macros to local.at, rename
- We'll want to use these in other test parts than just python. Make
  available everywhere and use "namespace" to avoid potential future
  clashes.
2010-12-16 17:18:21 +02:00
Panu Matilainen 5c43095e1d Implement transaction ordering hinting
- Add support for new "OrderWithRequires: foo" spec syntax
  which has "if and only if foo is present in transaction, order
  the transaction as if this package required foo" semantics.
  While it looks, and in some ways is, a soft dependency, this
  is not the same as recommends/suggests etc: those have unknown
  depsolver policy dependent semantics attached to them, whereas
  ordering hints have a clear definition and is only relevant for rpm
  itself, depsolvers should not even look at the data.
- This allows packages to express correct ordering for optional
  functionality, such as

      %post
      if [ -x %{_bindir}/register-component ]; then
          %{_bindir}/register-component %{name}
      fi

  If the package containing %{_bindir}/register-component is included
  in the same transaction, it makes sense to have it installed before the
  package(s) that use it. But as it is fully optional, Requires would
  not be appropriate. Using OrderWithRequires allows this to be expressed
  without dragging in extraneous dependencies for optional functionality.
2010-12-13 12:26:06 +02:00
Panu Matilainen 2a37d9a4dc Add beginnings of python bindings test-suite
- Add some basic infrastructure: point PYTHONPATH to the testing
  directory, helper macros to allow use of in-line python in test-suite
- Throw in a couple of simple tests for starters
2010-12-09 16:32:56 +02:00
Panu Matilainen 466cd4642b Add bunch of rpmvercmp() algorithm tests to the test-suite 2010-11-22 11:51:13 +02:00
Panu Matilainen 95a52a37e8 Move the current "version compare" tests to rpm install tests
- These are more about rpm install/upgrade behavior than pure
  version comparison, although obviously version comparison is involved
2010-11-22 11:51:13 +02:00
Panu Matilainen dc2ee980bc Remove RPMTAG_FILESTATUS tag extension
- This is a bad "API" for verification, it can't be controlled and
  causes heavy IO where one would not expect it. Getting rid of it now
  before anybody starts relying on it...
- Leaving :fstatus format extension alone however, it's at least harmless
  and produces a more predictable output than :vflags extension so it
  might be actually useful in scripts.
2010-11-15 11:12:50 +02:00
Panu Matilainen 90440e2036 Remove absolute paths from our popt exec aliases now that we can
- poptExecPath() pointing to meaningful place allows removal of these.
- Make test-suite rely on the --initdb exec alias so we catch out
 if anything here breaks
2010-11-15 10:23:27 +02:00
Panu Matilainen f8752d2ca3 Basic protection against Lua os.exit() and posix.exec() (ticket #167)
- Track posix.fork() and only allow exit() and exec() if the script
  has forked. There are other questionable items in posix extensions
  too but these are the worst offenders.
- Using Lua registry for tracking forked status might be more Lua-way
  option but this'll do for now.
2010-11-15 09:49:14 +02:00
Colin Walters eea47aa9a7 Add 'VCS' key
Spec files have a lot of metadata about a project.  However one of the
most key components is the upstream version control system which was
notably lacking.

Resolve this by adding a "VCS" key.  There is no specification
for contents of this key, given that the set of version control
systems (and features thereof) are not well-defined.  However,
recommendations are:

 * git: This URL should be in a form that can be passed to "git clone",
   with the additional feature that an optional fragment identifier "#foo"
   denotes a branch or tag.
2010-10-12 17:05:17 +03:00
Panu Matilainen e8a1f5da3e Lift specfile query out of main rpm(query) into separate binary
- Avoids having to link /bin/rpm with librpmbuild and everything it
  might bring in (eg libmagic) which are not needed for core operation.
- Minimally preserve backwards compatibility with popt exec alias
2010-10-04 14:31:55 +03:00
Panu Matilainen 5a1d5ddc84 Add test for manifest query in testsuite 2010-09-08 13:52:30 +03:00
Panu Matilainen 7562d2743b Add bunch of verification tests to the test suite
- Basic tests for dependency, file and verifyscript error + success
  behavior.
- Using lua for verifyscript to avoid issues with empty test-root
2010-09-07 11:14:56 +03:00
Panu Matilainen 9f68c7958f Rip IAM_RPMDB, ie --initdb, --rebuilddb etc modes out of rpmqv.c and librpm
- Add popt exec aliases to rpmdb for backwards compatibility
- Change test-suite to use 'rpmdb --initdb' instead of 'rpm --initdb'
  as popt exec aliases with absolute paths dont play very well
  with the test-suite, duh...
2010-09-03 17:13:10 +03:00
Steve Lawrence d06449dbaf Add files for testing SELinux collection/plugin
This adds two basic tarballs, one containing two minimal executables
(foo & bar), and one contain a simple policy for the two executables.
This also adds a new spec file with a policy subpackage, the new
%sepolicy section, and the sepolicy collection.
2010-09-01 09:31:10 +03:00
Steve Lawrence 383e275648 Add new %sepolicy section to the spec file format
The %sepolicy section is used to describe SELinux policy to be included
in a package. It's syntax is similar to other sections (%files, %pre,
%post, etc.) in that you can provide a string and -n after the
declaration to specify policy should be added to a subpackage.

For example:

%sepolicy
 # policy in this section will be added to the main package

%sepolicy foo
 # policy in this section will be added to the '<mainpackage>-foo' subpackage

%sepolicy -n bar
 # policy in this section will be added to the 'bar' subpackage

The %sepolicy section contains zero or more %semodule directives, with the
following format:

%semodule [OPTIONS] path/to/module.pp

The available options are:

-b, --base
	The module is a base module

-n, --name=NAME
	The name of the module. If not given, assumes the name is the basename of
	the module file with file extensions removed.

-t, --types=TYPES
	One or more comma-separated strings specifying which policy types the
	module can work with. To explicitly state that a module can work with any
	policy type, "default" can be specified as the value. If not specified,
	assumes the module can work with any policy type, and assigns the types as
	"default".

Below is an example of this new format:

  %sepolicy
  %semodule -n foo -t mls policy/foo.pp
  %semodule -n bar -t strict,targeted,mls -b policy/bar.pp

This also adds new header tags to store the new information:
 RPMTAG_POLICYNAMES        (string array)
 RPMTAG_POLICYTYPES        (string array)
 RPMTAG_POLICYTYPESINDEXES (uint32 array)
 RPMTAG_POLICYFLAGS        (uint32 array)

The index of NAMES and FLAGS maps directly to the index of RPMTAG_POLICIES.
However, because a single policy can have multiple types, the mapping for
TYPES is not direct. For this, the index maps to TYPESINDEXES, which
contains the index of the policy that the type maps to. This is similar to
how DIRINDEXES is used to map DIRNAMES and BASENAMES. As an example, the
previous %sepolicy section would have the following header tags:

RPMTAG_POLICIES:
 0: <foo.pp data, base64 encoded>
 1: <bar.pp data, base64 encoded>

RPMTAG_POLICYNAMES:
 0: foo
 1: bar

RPMTAG_POLICYFLAGS:
 0: 0
 1: 1	# assumes flag 1 == BASE

RPMTAG_POILCYTYPES:        RPMTAG_POLICYTYPESINDEXES:
 0: mls                     0: 0
 1: strict                  1: 1
 2: targeted                2: 1
 3: mls                     3: 1
2010-09-01 09:04:27 +03:00
Panu Matilainen d010ec1c90 Permit packages with no files to omit %files entirely
- Fixes the long standing obscure behavior of missing %files
  section causes build to complete without errors but without producing
  any packages either. Packages without files in them are perfectly
  valid (eg metapackages), requiring empty %files section for those
  is just unnecessary spec noise.
- Remove %files section on one of the test-suite specs to create
  a test-case for this as a side-effect.
- This of course introduces a slight incompatibility with older rpm's,
  if compatibility is required then just add those empty %files in the
  spec, they dont hurt anything but the readers eyes.
2010-08-26 12:31:01 +03:00
Panu Matilainen 6193eee71c Add a test-case for --specfile query 2010-08-18 12:32:23 +03:00
Panu Matilainen ab8ab164b9 Add %patch usage to hello.spec testcase 2010-08-18 11:55:19 +03:00
Steve Lawrence 0158708305 Add new Collections preamble tag
This adds a new Collections preamble tag, which contains a space separated list
of collection names that the package belongs to.
2010-06-22 11:12:43 +03:00
Panu Matilainen 00f1a6e0b1 Add header extension tag RPMTAG_FILESTATUS for file verification
- Permits basic file verification with just a headerGet(), with some
  caveats: there's no way to control which attributes get verified,
  and there's no filtering of mtime differences of shared files. Those
  aside, rpm -q --qf "[%{filestates:vflags} %{filenames}\n] <args>" now
  performs the same as "rpm -V --nodeps --noscripts <args>"
2010-05-28 12:21:34 +03:00
Panu Matilainen a0ed26b894 Add a basic reinstall test to test-suite
- this currently fails due to commit e16695e932,
  on reinstall element header vs db header mismatch, adding this as
  a reminder to fix it...
2010-04-21 11:52:24 +03:00
Panu Matilainen dcaec34d3f Update a few tag descriptions + visibility
- RPMTAG_CAPABILITY and RPMTAG_RHNPLATFORM are truly obsolete and
  should've been taken out a long time ago
2010-04-13 08:50:08 +03:00
Panu Matilainen 538ddff69c RPMTAG_NOSOURCE and NOPATCH aren't internal, they end up in nosrc headers 2010-04-13 08:32:49 +03:00
Panu Matilainen 09423eb470 Verify the various version comparison results in testsuite 2010-03-19 10:49:17 +02:00
Panu Matilainen d2d7ca7d43 Add some basic dependency check tests to test-suite 2010-03-18 12:34:44 +02:00