aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/powerpc/switch_endian/Makefile
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2015-03-28 21:35:17 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2015-03-28 22:08:47 +1100
commit4cd968ef4249fde24194b7b9a74be87dd7f8ed0f (patch)
tree1c749db1558db4e3d0c646c5f760ed828cbd8b86 /tools/testing/selftests/powerpc/switch_endian/Makefile
parentpowerpc: Add a proper syscall for switching endianness (diff)
downloadwireguard-linux-4cd968ef4249fde24194b7b9a74be87dd7f8ed0f.tar.xz
wireguard-linux-4cd968ef4249fde24194b7b9a74be87dd7f8ed0f.zip
selftests/powerpc: Add a test of the switch_endian() syscall
This adds a test of the switch_endian() syscall we added in the previous commit. We test it by calling the endian switch syscall, and then executing some code in the other endian to check everything went as expected. That code checks registers we expect to be maintained are. If the endian switch failed to happen that code sequence will be illegal and cause the test to abort. We then switch back to the original endian, do the same checks and finally write a success message and exit(0). Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools/testing/selftests/powerpc/switch_endian/Makefile')
-rw-r--r--tools/testing/selftests/powerpc/switch_endian/Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/switch_endian/Makefile b/tools/testing/selftests/powerpc/switch_endian/Makefile
new file mode 100644
index 000000000000..081473db22b7
--- /dev/null
+++ b/tools/testing/selftests/powerpc/switch_endian/Makefile
@@ -0,0 +1,24 @@
+CC := $(CROSS_COMPILE)gcc
+PROGS := switch_endian_test
+
+ASFLAGS += -O2 -Wall -g -nostdlib -m64
+
+all: $(PROGS)
+
+switch_endian_test: check-reversed.S
+
+check-reversed.o: check.o
+ $(CROSS_COMPILE)objcopy -j .text --reverse-bytes=4 -O binary $< $@
+
+check-reversed.S: check-reversed.o
+ hexdump -v -e '/1 ".byte 0x%02X\n"' $< > $@
+
+run_tests: all
+ @-for PROG in $(PROGS); do \
+ ./$$PROG; \
+ done;
+
+clean:
+ rm -f $(PROGS) *.o check-reversed.S
+
+.PHONY: all run_tests clean