Skip to contentSkip to conversation

Testcase for checking lvm module

PATCH In review BVK Chaitanya 2 participants 4 messages Mar 16, 2010 – Apr 9, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Testcase for checking lvm module

Hi,

Attached patch adds a testcase to check for GRUB's lvm module functionality. It configures lvm volumes on-the-fly on temporary disk images, and tests to see whether grub-shell ls command identifies them or not.

Since all of the LVM operations need root privilege, this real test is performed only when it is executed as root (or sudo make check); test simply passes otherwise. In future we may add sudo-check Makefile target to execute these type of tests automatically sing "sudo" feature.

Signature · 1 line
bvk.chaitanya
#1 lore raw

Attached!

Signature · 1 line
bvk.chaitanya

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [email protected] # target_branch: file:///home/bvk/work/grub2/mainline/
# testament_sha1: 9b533426627983a43022b8a2918a3b40f00984a0 # timestamp: 2010-03-17 07:43:03 +0530
# base_revision_id: [email protected]\
# q8ppihzgyjyifcke
#
# Begin patch
=== modified file 'conf/tests.rmk'

tests.rmk +4 -0
@@ -50,6 +50,9 @@
 check_SCRIPTS += grub_script_vars1
 grub_script_vars1_SOURCES = tests/grub_script_vars1.in
 
+check_SCRIPTS += lvm_test
+lvm_test_SOURCES = tests/lvm_test.in
+
 # List of tests to execute on "make check"
 # SCRIPTED_TESTS    = example_scripted_test
 # SCRIPTED_TESTS   += example_grub_script_test
@@ -59,6 +62,7 @@
 SCRIPTED_TESTS  = grub_script_echo1
 SCRIPTED_TESTS += grub_script_echo_keywords
 SCRIPTED_TESTS += grub_script_vars1
+SCRIPTED_TESTS += lvm_test
 
 # dependencies between tests and testing-tools
 $(SCRIPTED_TESTS): grub-shell grub-shell-tester

=== added file 'tests/lvm_test.in'

lvm_test.in +56 -0

56 lines not on this page · raw message

# Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWUDUA8sAAtDfgEAwfmv//14u 3wD////+YAZuL4adKLOcrroCQADSaJqYKeCanlD2pDaNQGgGR6mMoDJo8oJ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j d5o3oV/65lO+cghh+8tbFBuGRYQYvSZ1zwzlu9islEj7X2uzPnQfkRyXACjfcfVwmcUw//vE8xXx ICIZBnEQxgPvaME8mQVYa8dOotTolKUULMmy1kCijkxFoW7AKszdbA/jh3vGw5wMwM8q6QupDcQr LSU0MbuCxn2dZmqJP/IqpQbSSX9gskiCqg9uW0quMJfZukG4AwVnYYjHUEP5x7dPU9Cbt2J2O8Ct HH4pRkdNSw5JGnNr6xADYNbVQ1WJ3ydYtmyrs4sLxoOYsMJ6ikY7p8/Hh0zkAzJOgkKgSpRwJI5F FKrGq5psth76tpnYUd2VC0kePEkuX7eo5adxg0/CGGTndq32H9d5xKwwF8kKr1QrtPn08FZw4M4u v6QCwYyNTqa2DOMZLM0ClW3Q1/az80NL6IPCqP4LqvLyWaFTpBaCwqOOQy7B2Ro+v278I70Y+5DA HiY6e018GDQBM9ty5yoYYsQnQvllIPvLAHXpyRUlEOp7kL6pDgwFgRgDbzXO9gmwcmDL5gQKm2u7 ecPMPTptRPtztMhLSlBpyBLX0DCAUUifYQbg5uFcAMbmwDcaKMPipwGozhjMQFUqmcqRlQ7lkkUW ENcURTQCUoUCZgvTqW3vT7xiNl7XJH2A5CXaxFnrG1d6zCFKGXX7oKo3i9MCipC+fh4B2Nhw37dh B1w4sMHYzssHmtOsPZV1lboUsiMA1/TcuGgfJkGHIsY1LwgjOpKSXW+zSqt2ojWvVapSqQpVgUs8 E460jGNIlOhCfrtUdpppFzLLIq4fEzc1oiY8DyIgF66N0vBWoZDdNRDwGSpL445kqohKTwPQJkKJ pRiHGR0V2JFkNq7m9oI454C9o6MNGsbC9GKqGdHMDlOITyFyWMlu+aDk9K4adxodCcLhwLRLJQZU LURRWhREiAG1UET1LvjSXjIvXdi3suCkbw2C8lC/8RIGH6+P4uQdONlsB+BIOIpxdOP/8XckU4UJ BA1APLA=

#2 lore raw
Quoted 4 lines · BVK Chaitanya

Attached!

+size=128M
+disk1=mktemp
+disk2=mktemp
Plain mktemp will fail on FreeBSD. Idk for well freebsd supports linux lvm though
+lvm=/sbin/lvmn
+parted=/sbin/parted
+losetup=/sbin/losetup
You don't check for real existence of these files. And letting use $PATH is better IMO than hardcoding path to executables +if test id -u != "0"; then
+ exit 0
+fi
+
There should be a warning here

Quoted 7 lines

------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#3 lore raw
In reply to BVK Chaitanya
Quoted 8 lines · BVK Chaitanya

Hi,

Attached patch adds a testcase to check for GRUB's lvm module functionality. It configures lvm volumes on-the-fly on temporary disk images, and tests to see whether grub-shell ls command identifies them or not.

Quoted 7 lines

Since all of the LVM operations need root privilege, this real test is performed only when it is executed as root (or sudo make check); test simply passes otherwise. In future we may add sudo-check Makefile target to execute these type of tests automatically sing "sudo" feature.

Using sudo in any of the grub scripts isn't an option. Would you like the programs you install silently acquiring root rights? At the limited we can make a priviliged-tests target which user will execute like:
sudo make privelegied-tests
Or we can make a script generate-gnu-linux-images.sh which will create all filesystem and lvm images needing root privelgies. This will also make repeated make check faster
But it's way better to avoid needing root privelegies in the first place. In particular operations with images shouldn't need root privelegies. Have you looked into fakeroot program?

Quoted 2 lines
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko