Browse Source

Improve LTP output parsing and environment preparation

Chia-Che Tsai 6 years ago
parent
commit
f6a2916462

+ 4 - 0
LibOS/shim/test/apps/ltp/Makefile

@@ -40,5 +40,9 @@ $(TESTCASEDIR)/manifest.template: manifest.template
 $(TESTCASEDIR)/Makefile: Makefile.testcases
 	ln -sf ../../../../$< $@
 
+regression: $(target)
+	@echo "\n\nLTP tests for system calls:"
+	./syscalls.sh
+
 clean-build:
 	rm -rf $(BUILDDIR)

+ 12 - 1
LibOS/shim/test/apps/ltp/Makefile.testcases

@@ -2,10 +2,21 @@ manifests = $(wildcard ../../../../*.manifest.template) manifest
 testcases = $(filter-out $(wildcard *.*) $(patsubst %/,%,$(wildcard */)) Makefile manifest pal_loader,$(wildcard *))
 
 exec_target = $(testcases)
-target = $(manifests) $(testcases)
+target = $(manifests) $(testcases) /tmp/shm etc/nsswitch.conf etc/passwd
 
 level = ../../../../../../
 include ../../../../../../Makefile
 
 $(addsuffix .template,$(manifests)): %: ../../../../%
 	ln -sf $< $@
+
+/tmp/shm:
+	mkdir -p $@
+
+etc/nsswitch.conf:
+	mkdir -p etc
+	echo "passwd: compat\ngroup: compat\nshadow: compat\nhosts: files" > $@
+
+etc/passwd:
+	mkdir -p etc
+	echo "root:x:0:0:root:/root:/bin/bash\nnobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin" > $@

+ 22 - 11
LibOS/shim/test/apps/ltp/fetch.py

@@ -43,38 +43,48 @@ def finish(result):
             current_hanged[test] = 1
         else:
             reported = False
+            count = 1
             for output in result['output']:
-                toks = output.split()
-                if len(toks)<2 or (toks[0] != test and test != "memcmp01" and test != "memcpy01"):
+                tokens = output.split()
+                if len(tokens) < 2:
                     continue
-                test_subtest = test + "," + toks[1]
-                test_subtest = test_subtest
+                if tokens[1].isdigit():
+                    test_subtest = test + "," + tokens[1]
+                    count = int(tokens[1]) + 1
+                else:
+                    test_subtest = test + "," + str(count)
+                    count = count + 1
                 if "TINFO" in output or test_subtest in current_passed or test_subtest in current_failed or test in current_hanged or test_subtest in current_broken:
                     continue
+
                 if output:
                     output = output.strip()
                     print >>f1, output
+
                 if "TFAIL" in output:
                     print >>failed_tests_fh, test_subtest
                     print CRED + "[Fail   ] " + test_subtest + CEND
                     current_failed[test_subtest] = 1
                     reported = True
-                elif "TPASS" in output:
+
+                elif "TPASS" in output or "PASS:" in output:
                     print >>passed_tests_fh, test_subtest
                     print CGREEN + "[Pass   ] " + test_subtest + CEND
                     current_passed[test_subtest] = 1
                     reported = True
-                elif "TCONF" in output or "TBROK" in output or "error" in output:
+
+                elif "TCONF" in output or "TBROK" in output or "BROK" in output or "error" in output:
                     print >>broken_tests_fh, test_subtest
-                    print "[Broken ] " + test_subtest      #Syscall not implemented or test preparation failed
+                    # Syscall not implemented or test preparation failed
+                    print "[Broken ] " + test_subtest
                     current_broken[test_subtest] = 1
                     reported = True
-            #else:
-            #    print "[Broken ] " + test      #Syscall not implemented or test preparation failed
+
             if (not reported):
                 print >>broken_tests_fh, test
                 print CRED + "[Broken ] " + test + CEND
                 current_broken[test] = 1
+
     except Exception as e:
         print str(e)
 
@@ -117,6 +127,7 @@ os.chdir("opt/ltp/testcases/bin")
 pool = multiprocessing.Pool()
 with open('../../../../syscalls.graphene') as testcases:
     for line in testcases:
+        line = line.strip('\r\n\t')
         tokens = line.split( )
         if (tokens[1] == "SGX") :
             test = tokens[2]
@@ -145,11 +156,11 @@ with open(stablePass, 'rb') as csvfile:
 
 print "\n\nRESULT [Difference] :\n---------------------\n"
 
-for test in stable_passed:
+for test in sorted(stable_passed):
     if not test in current_passed:
         print CRED + "Test '" + test + "' did not pass in the current run!!" + CEND
 
-for test in current_passed:
+for test in sorted(current_passed):
     if not test in stable_passed:
         print CGREEN + "Test '" + test + "' passed in the current run!!" + CEND
 print "\n"

+ 7 - 2
LibOS/shim/test/apps/ltp/manifest.template

@@ -1,15 +1,20 @@
 loader.preload = file:$(SHIMPATH)
-loader.env.LD_LIBRARY_PATH = /lib:/lib64:/usr/lib:/usr/lib64
+loader.env.LD_LIBRARY_PATH = /lib:/lib/x86_64-linux-gnu:/usr/lib:/usr/lib64
+loader.env.PATH = /bin:/usr/bin:.
 loader.debug_type = none
 
 fs.mount.shm.type = chroot
 fs.mount.shm.path = /dev/shm
-fs.mount.shm.uri = file:/dev/shm
+fs.mount.shm.uri = file:/tmp
 
 fs.mount.lib.type = chroot
 fs.mount.lib.path = /lib
 fs.mount.lib.uri = file:$(LIBCDIR)
 
+fs.mount.lib64.type = chroot
+fs.mount.lib64.path = /lib/x86_64-linux-gnu
+fs.mount.lib64.uri = file:/lib/x86_64-linux-gnu
+
 fs.mount.usr.type = chroot
 fs.mount.usr.path = /usr
 fs.mount.usr.uri = file:/usr

+ 0 - 2
LibOS/shim/test/regression/Makefile

@@ -55,8 +55,6 @@ regression: $(target)
 	@for f in $(wildcard 30_*.py); do env $(PYTHONENV) python $$f $(RUNTIME)/pal-$(PAL_HOST); done
 	@echo "\n\nLarge File Support:"
 	@for f in $(wildcard 90_*.py); do env $(PYTHONENV) python $$f $(RUNTIME)/pal-$(PAL_HOST); done
-	@echo "\n\nLTP tests for system calls:"
-	../apps/ltp/syscalls.sh
 
 clean-tmp:
 	rm -rf *.tmp ../apps/ltp/*.csv *.cached *.manifest.sgx *~ *.sig *.token