User:Maffblaster/Drafts/Advanced ebuild testing guide

This guide provides instructions for users to create their own chroot test environments. This is helpful for those who would like to test their ebuilds in a basic environment.

Introduction
Chroots have been around for a long time. Apparently the first "chroot" system call was introduced in Version 7 Unix in 1979.

Official Gentoo Stage3 tarballs
The officially generated stage3 tarballs from the Release Engineering project are perfect specimens to use for creating new chroots, they can be generally obtained from the following links:

Custom stage3 tarballs
Have a currently running system that would be nice to use a test environment? Use the command to compress it into a stage3 or stage4 tarball, just make sure label it appropriately:

Snapshotable filesystems (btrfs, zfs)
When using a filesystem that has the capability to create snapshots, it is possible to quickly generate chroot test environments.

Btrfs
To make a 'chroot' snapshot of the currently running system with btrfs, issue:

Then simply run the mount commands for the appropriate virtual filesystems.

Zfs
If you want to take a snapshot of a single dataset in zfs you would do the following:

If you want to take a snapshot of every dataset under a particular dataset, you can do:

LXC
https://github.com/globalcitizen/lxc-gentoo

https://github.com/specing/lxc-gentoo