Skip to contentSkip to conversation

xfstests-bld: add an android-xfstests command

PATCH In review Eric Biggers 2 participants 2 messages Mar 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests-bld: add an android-xfstests command

From: Eric Biggers <[email protected]>

Add a command android-xfstests which has an interface similar to kvm-xfstests and gce-xfstests, but runs xfstests on the internal storage of an Android device instead. It works by setting up temporary partitions in space freed up by reformatting the userdata filesystem with a smaller size, then running the tests in a Debian chroot. More information can be found in the documentation in android-xfstests.md.

Some features of kvm-xfstests and gce-xfstests, such as selecting the kernel to use, are not yet implemented for android-xfstests but may be possible to add later.

So far I have only tested android-xfstests on two devices, but it's intended to work on other devices too.

---
 .gitignore                                         |   1 +
 Documentation/00-index.md                          |   2 +-
 Documentation/android-xfstests.md                  | 214 +++++++++++----
 Makefile                                           |  15 +-
 kvm-xfstests/android-xfstests                      | 289 +++++++++++++++++++++
 kvm-xfstests/android-xfstests.in                   |   7 +
 kvm-xfstests/config                                |  30 ++-
 kvm-xfstests/gce-xfstests                          |   2 +-
 kvm-xfstests/kvm-xfstests                          |   1 +
 kvm-xfstests/test-appliance/.gitignore             |   1 +
 .../test-appliance/android-setup-partitions        | 221 ++++++++++++++++
 kvm-xfstests/test-appliance/android-test-config    |  13 +
 kvm-xfstests/test-appliance/gce-create-image       |   2 +-
 kvm-xfstests/test-appliance/gce-export-image       |   2 +-
 kvm-xfstests/test-appliance/gce-import-image       |   2 +-
 kvm-xfstests/util/gce-do-setup                     |   2 +-
 kvm-xfstests/util/get-config                       |  23 +-
 kvm-xfstests/util/parse_cli                        | 169 ++++++------
 18 files changed, 824 insertions(+), 172 deletions(-)
 create mode 100755 kvm-xfstests/android-xfstests
 create mode 100644 kvm-xfstests/android-xfstests.in
 create mode 100755 kvm-xfstests/test-appliance/android-setup-partitions
 create mode 100644 kvm-xfstests/test-appliance/android-test-config
.gitignore +1 -0
index 96f011a..db604f8 100644
@@ -11,6 +11,7 @@ config.log
 config.status
 config.custom
 MAKELOG
+/android-xfstests.sh
 /kvm-xfstests/config-*
 /kvm-xfstests.sh
 /gce-xfstests.sh
Documentation/00-index.md +1 -1
index 335324b..302b137 100644
@@ -6,7 +6,7 @@ eventually use gce-xfstests.  Also please see the top-level
 [README](../README.md) file for this project.
 
 * [android-xfstests](android-xfstests.md)
-  * Instructions for running xfstests on an Android device
+  * Instructions for using android-xfstests
 * [building-rootfs](building-rootfs.md)
   * Documentation for the gen-image script
 * [building-xfstests](building-xfstests.md)
Documentation/android-xfstests.md +162 -52

217 lines not on this page · raw message

Makefile +7 -8
index f5a90af..f5e2245 100644
@@ -16,18 +16,17 @@ SUBDIRS =	acl \
 		xfsprogs-dev \
 		xfstests-dev
 
-all: xfsprogs-dev xfstests-dev fio quota \
-	gce-xfstests.sh kvm-xfstests.sh
+SCRIPTS =	android-xfstests.sh \
+		gce-xfstests.sh \
+		kvm-xfstests.sh
+
+all: xfsprogs-dev xfstests-dev fio quota $(SCRIPTS)
 	./build-all
 
 xfsprogs-dev xfstests-dev fio quota:
 	./get-all
 
-gce-xfstests.sh: kvm-xfstests/gce-xfstests.in
-	sed -e "s;@DIR@;$$(pwd);" < $< > $@
-	chmod +x $@
-
-kvm-xfstests.sh: kvm-xfstests/kvm-xfstests.in
+$(SCRIPTS): %.sh: kvm-xfstests/%.in
 	sed -e "s;@DIR@;$$(pwd);" < $< > $@
 	chmod +x $@
 
@@ -38,7 +37,7 @@ clean:
 	done
 	make -C xfsprogs-dev realclean
 	rm -rf bld xfstests
-	rm -f kvm-xfstests/util/zerofree gce-xfstests.sh kvm-xfstests.sh
+	rm -f kvm-xfstests/util/zerofree $(SCRIPTS)
 
 kvm-xfstests/util/zerofree: kvm-xfstests/util/zerofree.c
 	cc -static -o $@ $< -lext2fs -lcom_err -lpthread
kvm-xfstests/android-xfstests new file +289 -0

289 lines not on this page · raw message

kvm-xfstests/android-xfstests.in new file +7 -0
new file mode 100644
index 0000000..634c93d
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+DIR=@DIR@
+
+ANDROID_XFSTESTS_DIR=$DIR/kvm-xfstests
+export ANDROID_XFSTESTS_DIR
+exec $ANDROID_XFSTESTS_DIR/android-xfstests "$@"
kvm-xfstests/config +23 -7
index 0f1d432..4e7bb19 100644
@@ -1,14 +1,30 @@
 #
-# Customize these or put new values in ~/.config/kvm-xfstests or config.custom
+# Customize these, or put new values in:
+#
+#		~/.config/kvm-xfstests
+#	or
+#		~/.config/gce-xfstests
+#	or
+#		~/.config/android-xfstests
+#
+# ... to affect specific commands only;
+#
+# or in config.custom to affect all commands.
+#
+
+###############################################################################
+# Common configuration
+#
+PRIMARY_FSTYPE="ext4" # all commands
+NR_CPU=2 # kvm-xfstests and gce-xfstests
+MEM=2048 # kvm-xfstests and gce-xfstests
+
+###############################################################################
+# KVM configuration
 #
 #QEMU=/usr/local/bin/qemu-system-x86_64
 QEMU=/usr/bin/kvm
 KERNEL=$HOME/linux
-NR_CPU=2
-MEM=2048
-CONFIG_DIR=$HOME/.config
-
-PRIMARY_FSTYPE="ext4"
 ROOT_FS=$DIR/test-appliance/root_fs.img
 ROOT_DEV=/dev/vda
 VDB=$DIR/disks/vdb
@@ -40,10 +56,10 @@ MONITOR="-monitor telnet:localhost:7498,server,nowait"
 CONSOLE=" -serial mon:stdio"
 #CONSOLE=" -chardev stdio,id=console,signal=off -serial chardev:console"
 
+###############################################################################
 # GCE configuration
 #
 # GS_BUCKET=gs_bucket.thunk.org
 # GCE_PROJECT=tytso-xfstests-project
 # GCE_ZONE=us-central1-c
 # GCE_KERNEL=/u1/ext4-64/arch/x86/boot/bzImage
-
kvm-xfstests/gce-xfstests +1 -1
index 084b30c..7b678bc 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-GCE_XFSTESTS=yes
+XFSTESTS_FLAVOR=gce
 DIR=.
 if test -n "$GCE_XFSTESTS_DIR"
 then
kvm-xfstests/kvm-xfstests +1 -0
index 0d764a2..01fbee3 100755
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+XFSTESTS_FLAVOR=kvm
 DIR=.
 if test -n "$KVM_XFSTESTS_DIR"
 then
kvm-xfstests/test-appliance/.gitignore +1 -0
index 2c0d90e..14bb19a 100644
@@ -1,3 +1,4 @@
+armhf_root_fs.*
 debs
 root_fs.img*
 root_fs.raw
kvm-xfstests/test-appliance/android-setup-partitions new file +221 -0

221 lines not on this page · raw message

kvm-xfstests/test-appliance/android-test-config new file +13 -0
new file mode 100644
index 0000000..0bb8ffd
@@ -0,0 +1,13 @@
+export PRI_TST_DEV=$(readlink /dev/block/xfstests/PRI_TST_DEV)
+export SM_SCR_DEV=$(readlink /dev/block/xfstests/SM_SCR_DEV)
+export SM_TST_DEV=$(readlink /dev/block/xfstests/SM_TST_DEV)
+export LG_SCR_DEV=$(readlink /dev/block/xfstests/LG_SCR_DEV)
+export LG_TST_DEV=$(readlink /dev/block/xfstests/LG_TST_DEV)
+
+export PRI_TST_MNT=/vdb
+export SM_SCR_MNT=/vdc
+export SM_TST_MNT=/vdd
+export LG_SCR_MNT=/vde
+export LG_TST_MNT=/vdf
+
+PATH="/root/xfstests/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
kvm-xfstests/test-appliance/gce-create-image +1 -1
index c82ce04..913286f 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-GCE_XFSTESTS=yes
+XFSTESTS_FLAVOR=gce
 DIR=..
 if test -n "$GCE_XFSTESTS_DIR"
 then
kvm-xfstests/test-appliance/gce-export-image +1 -1
index 3d0f1b9..3ef1607 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-GCE_XFSTESTS=yes
+XFSTESTS_FLAVOR=gce
 DIR=..
 if test -n "$GCE_XFSTESTS_DIR"
 then
kvm-xfstests/test-appliance/gce-import-image +1 -1
index d4b75df..8e8a43b 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-GCE_XFSTESTS=yes
+XFSTESTS_FLAVOR=gce
 DIR=..
 if test -n "$GCE_XFSTESTS_DIR"
 then
kvm-xfstests/util/gce-do-setup +1 -1
index cd4cd6e..386ea6d 100755
@@ -3,7 +3,7 @@
 # For a more fool-proof gce-xfstests setup,,,
 #
 
-GCE_XFSTESTS=yes
+XFSTESTS_FLAVOR=gce
 DIR=.
 if test -n "$GCE_XFSTESTS_DIR"
 then
kvm-xfstests/util/get-config +11 -12
index 0b40d9f..b1ffc8f 100644
@@ -1,25 +1,24 @@
 #
-# Read the config files used for kvm-xfstests
+# Read the config files used for kvm-xfstests, gce-xfstests, etc.
 #
 # Shell scripts should use this file as follows:
 #
-#DIR=.
-#if test -n "$KVM_XFSTESTS_DIR"
-#then
-#    DIR="$KVM_XFSTESTS_DIR"
-#fi
+# XFSTESTS_FLAVOR=kvm # (or gce, etc.)
+# DIR=.
+# if test -n "$KVM_XFSTESTS_DIR" # (or $GCE_XFSTESTS_DIR, etc.)
+# then
+#     DIR="$KVM_XFSTESTS_DIR"
+# fi
 #
 # . "$DIR/util/get-config"
 
 . $DIR/config
 
-if test -n "$GCE_XFSTESTS" -a -f "$CONFIG_DIR/gce-xfstests" ; then
-   . $CONFIG_DIR/gce-xfstests
-elif test -f "$CONFIG_DIR/kvm-xfstests"; then
-   . $CONFIG_DIR/kvm-xfstests
-fi
+# Source the user-provided config if present (e.g. ~/.config/kvm-xfstests)
+[ -f "$HOME/.config/${XFSTESTS_FLAVOR}-xfstests" ] && \
+	. "$HOME/.config/${XFSTESTS_FLAVOR}-xfstests"
 
-if test -n "$GCE_XFSTESTS" -a -z "$GCE_ACCOUNT" -a \
+if test "$XFSTESTS_FLAVOR" = "gce" -a -z "$GCE_ACCOUNT" -a \
    -n "$(ls $DIR/config-* 2> /dev/null)"
 then
    # We aren't just using GCE_ACCOUNT=$(...) to work around a performance
kvm-xfstests/util/parse_cli +82 -87

276 lines not on this page · raw message

Signature · 1 line
2.12.0.rc1.440.g5b76565f74-goog
#1 lore raw
Quoted 9 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Add a command android-xfstests which has an interface similar to kvm-xfstests and gce-xfstests, but runs xfstests on the internal storage of an Android device instead. It works by setting up temporary partitions in space freed up by reformatting the userdata filesystem with a smaller size, then running the tests in a Debian chroot. More information can be found in the documentation in android-xfstests.md.

Quoted 8 lines

Some features of kvm-xfstests and gce-xfstests, such as selecting the kernel to use, are not yet implemented for android-xfstests but may be possible to add later.

So far I have only tested android-xfstests on two devices, but it's intended to work on other devices too.

Very Nice! Thanks, applied.

- Ted