sgfxi :: development tools: set test data

sgfxi has a few advanced development aids because maintaining fglrx and nvidia over time is a pain in the butt.

The most important one is the ability to emulate for development purposes another card, to run the initial download, extract, and patch operations on any driver, without changing your own system.

other testing and development information

Also make sure to read the developer's sticky options section to set repeated test conditions and flags using the external values file method. For this page, I'll be focusing on just using the sgfxi built in options for development.

For more information on testing and debugging patches themselves, see the sgfxi patches documentation page.

set test data

sgfxi has a built in testing function, which it triggered by starting sgfxi with the -T flag, set_test_data(). This might change over time, so get the latest sgfxi and confirm that the test data is current, but this is the basic idea (at about line 270 of sgfxi):

These tests will be run as user, not root, that also ensures you don't set root permissions on the download directories and files, and also of course that you don't accidentally remove your current drivers or do something else you didn't intend.

sgfxi test data will expect to see this directory: /home/<username>/bin/scripts/graphics - unless you have some overwhelmingly pressing reason not to create one there, I suggest you do it to keep things simple and non confusing, and so you don't always have to re-edit sgfxi. Put your working copy of sgfxi there too, then it will all be simple.

This test configuration is for testing ATI fglrx, with default driver 8-7, and was testing the 2.6.26 patch. IS_SIDUX_KERNEL is set to '' because sgfxi > 2.6.25 slh kernels do not support fglrx drivers, so we need to switch that off here for the testing in a sidux system.

# only for debugging purposes
set_test_data()
{
	local username=''

	if [ "$B_TESTING_1" == 'true' ] # set testing directories etc
	then
## NOTE: it's important to start all comments in here at first character for cleanup updater
#		# this is required for testing to make sure we always are starting with true
#		# latest script versions
# 		rm -f sgfxi.log
# 		# note: devs: double check this output to make sure it's your user name
 		username=$( getent passwd 1000|cut -d \: -f1 )
 		SCRIPT_HOME="/home/$username/bin/scripts/graphics/"
 		INSTALL_WORKING_DIR="/home/$username/bin/scripts/graphics/"
 		LOG_FILE_DIR="/home/$username/bin/scripts/graphics/"
 		cd $SCRIPT_HOME
 		# sgfxi doesn't support any legacy ATI stuff
 		CARD_DATA=1002:7280 # fake ati
# 		CARD_DATA=10de:0020 # fake nvidia oldest legacy (7x.xx.xx drivers)
# 		CARD_DATA=10de:0280 # fake nvidia mid legacy (9x.xx.xx drivers)
# 		CARD_DATA=10de:0322 # fake nvidia 5xxx legacy (173.xx.xx drivers)
# 		CARD_DATA=10de:0422 # fake nvidia current card (GS 8400)
# 		FG_DEFAULT='8-5'
# 		NV_DEFAULT='177.80'
# 		# set system bits to test 32/64 specific behaviors
# 		BITS=64
# 		# if you want to test for/without sidux kernels, set to null '' or 'true'
 		IS_SIDUX_KERNEL=''
# 		# to test patches/error handling for a specific kernel major version,
# 		# ie: 2.6.25 here
# 		KERNEL_THIRD=25
# 		# check for specific system base tests, can be:
# 		# 'sid' 'testing' 'stable' 'etch'
# 		SYSTEM_BASE='testing'
# leave this at first character or errors in updater tools will occur
:
	fi
}

Please note that sgfxi will still show your real card information in the initial startup section, but that's not related to what it will use internally, which is set using the data below.

alternate testing data

Here's a brief overview of what the various options are for test data.

script defaults data

This sets different system data. Usually you want to make most of these active so you can do testing as non root user, using your working copies and locations.

  1. rm -f sgfxi.log - remove the development logs for each run through if you want. This one is optional, doesn't really matter, if you want a new log each time, use it, if you want to keep the same log, don't worry about it.
  2. username=$( getent passwd 1000|cut -d \: -f1 ) - sets your default user name for the /home/..../bin/scripts/graphics path.
  3. SCRIPT_HOME="/home/$username/bin/scripts/graphics/" - set the development directory. Default non dev is /usr/local/bin
  4. INSTALL_WORKING_DIR="/home/$username/bin/scripts/graphics/" - set the directory for sgfxi driver downloads (for normal use, non testing, it's /usr/src)
  5. LOG_FILE_DIR="/home/$username/bin/scripts/graphics/" - Make sure to set this to a user writable location, otherwise sgfxi will exit with errors when it tries to write to the default /var/log/sgfxi location for logging.
  6. cd $SCRIPT_HOME - Make sure sgfxi is in the right place before things run.

alternate card data

Set alternate card data to make sgfxi think your card is something else. Good for testing and debugging download/extract/patch section of the script.

  1. CARD_DATA=1002:7280 # fake ati - Tell sgfxi that it's installing to an ATI card, fglrx driver. This is for testing download paths and patching of binary installer files if needed.
  2. CARD_DATA=10de:0020 # fake nvidia oldest legacy (7x.xx.xx drivers) - Test a legacy nvidia, very old card, sets LEGACY_LEVEL 1 (7x.xx.xx drivers).
  3. CARD_DATA=10de:0280 # fake nvidia mid legacy (9x.xx.xx drivers) - Test mid level nVidia legacy card, sets LEGACY_LEVEL 2 (9x.xx.xx drivers).
  4. CARD_DATA=10de:0322 # fake nvidia 5xxx legacy - Test a 5xxx legacy nvidia, sets LEGACY_LEVEL 3 (173.xx.xx drivers).
  5. CARD_DATA=10de:0422 # fake nvidia current card (GS 8400) - Test standard default nvidia card.
  6. FG_DEFAULT='8-5' - change script default driver for this card.
  7. NV_DEFAULT='177.80' - change script default driver for nVidia card. Note: you have to also check the various error handling places and add any unsupported driver there.

set system data

You can also change a few core system data items, you shouldn't need more than this usually, but if you do need it, just let someone know.

  1. BITS=64 - trigger either 32 or 64 bit components of sgfxi, useful for testing output, downloads, patches, and so on. DO NOT install a 64 bit driver to 32 bit, or a 64 bit to 32.
  2. IS_SIDUX_KERNEL='' - Useful to trigger a few of the sidux / not sidux kernel tests. Values: '' or 'true'
  3. KERNEL_THIRD=25 - Change the current major kernel version for testing purposes, so you can run anything in your current system without reboots etc. Major version means in this case: 2.6.25 kernel. 26 would be 2.6.26, and so on.
  4. SYSTEM_BASE='testing - Change the system base id to test anything that is specific to some other system than your current one.

running the tests

without actual install

Once you have set this data, you can run sgfxi to test the download, extraction, and patching, of the driver you want to test.

sgfxi -! 5

Note that -! 5 triggers both the testing data replacement, as well as any other testing conditions you might have added, and skips some checks and tests, and then exits after download, extraction, and any patching has been done.

with actual install

If you want to test the driver install for real, assuming you have the proper card installed, run sgfxi with -! 1:

sgfxi -! 1

To do this, you can either comment out the debugging paths, username, and cd commands above, and just leave the card data uncommented, then run sgfxi where it expects to be, /usr/local/bin, or you can leave it, but remember, root will own those files in your dev directory.

Remember to remove these after you're done! or you could trigger undesired results.