Browse Source

various testing fixes and cleanups

The MMGen Project 2 years ago
parent
commit
3fc105ffec

+ 4 - 2
test/test-release.d/cfg.sh

@@ -162,7 +162,8 @@ init_tests() {
 
 	[ "$MSYS2" ] && t_alts_skip='m z'  # no moneropy (pysha3), zcash-mini (golang)
 	[ "$ARM32" ] && t_alts_skip='z e'
-	[ "$DISTRO" == 'arch' -o "$DISTRO" == 'archarm' ] || t_alts_skip+=' e' # ethkey available only on Arch Linux
+	# ARM ethkey available only on Arch Linux:
+	[ \( "$ARM32" -o "$ARM64" \) -a "$DISTRO" != 'archarm' ] && t_alts_skip+=' e'
 
 	f_alts='Gen-only altcoin tests completed'
 
@@ -184,7 +185,8 @@ init_tests() {
 
 	[ "$FAST" ] && t_eth_skip='oe'
 	[ "$ARM32" -o "$ARM64" ] && t_eth_skip+=' parity'
-	[ \( "$ARM32" -o "$ARM64" \) -a "$DISTRO" != 'archarm' ] && t_eth_skip+=' oe' # ARM oe available only on ArchLinuxArm
+	# ARM openethereum available only on ArchLinuxArm:
+	[ \( "$ARM32" -o "$ARM64" \) -a "$DISTRO" != 'archarm' ] && t_eth_skip+=' oe'
 
 	i_autosign='Autosign'
 	s_autosign='The bitcoin, bitcoin-bchn and litecoin mainnet and testnet daemons must be running for the following test'

+ 4 - 1
test/test_py_d/ts_ethdev.py

@@ -1312,7 +1312,10 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
 		from mmgen.tw.ctl import TrackingWallet
 		tw = await TrackingWallet(self.proto)
 		imsg(f'Moving tracking wallet')
-		os.rename( tw.tw_fn, tw.tw_fn+'.bak.json' )
+		bakfile = tw.tw_fn + '.bak.json'
+		if os.path.exists(bakfile):
+			os.unlink(bakfile)
+		os.rename( tw.tw_fn, bakfile )
 		return 'ok'
 
 	def twimport(self,add_args=[],expect_str=None):

+ 1 - 1
test/unit_tests_d/ut_daemon.py

@@ -53,7 +53,7 @@ def test_flags_err(ut,d):
 
 def test_cmd(args_in,message):
 	qmsg_r(message)
-	args = [f'test/{args_in[0]}-coin-daemons.py'] + list(args_in[1:])
+	args = ['python3', f'test/{args_in[0]}-coin-daemons.py'] + list(args_in[1:])
 	vmsg('\n' + orange(f"Running '{' '.join(args)}':"))
 	pipe = None if opt.verbose else PIPE
 	cp = run( args, stdout=pipe, stderr=pipe, check=True )

+ 5 - 3
test/unit_tests_d/ut_dep.py

@@ -103,12 +103,14 @@ class unit_tests:
 		N,r,p = 4,8,16
 		buflen = 64
 
-		import scrypt
-		scrypt.hash(passwd, salt, N=2**N, r=r, p=p, buflen=buflen)
-
+		vmsg('Testing builtin scrypt module (hashlib)')
 		from hashlib import scrypt # max N == 14!!
 		scrypt(password=passwd,salt=salt,n=2**N,r=r,p=p,maxmem=0,dklen=buflen)
 
+		vmsg('Testing standalone scrypt module')
+		import scrypt
+		scrypt.hash(passwd, salt, N=2**N, r=r, p=p, buflen=buflen)
+
 		return True
 
 	def solc(self,name,ut):

+ 4 - 5
test/unit_tests_d/ut_scrypt.py

@@ -40,7 +40,6 @@ class unit_test(object):
 					assert ret == res, ret
 
 		def test_presets(do_presets):
-			vmsg('  id    N   p  r')
 			for hp in do_presets:
 				hp = str(hp)
 				res = presets[hp]
@@ -59,15 +58,15 @@ class unit_test(object):
 			silence()
 
 		g.force_standalone_scrypt_module = False
-		vmsg('Passwords:')
+		vmsg('Passwords (auto module selection):')
 		test_passwords()
-		vmsg('Hash presets:')
+		vmsg('Hash presets (auto module selection):')
 		test_presets((1,2,3,4) if opt.fast else (1,2,3,4,5,6,7))
 
 		g.force_standalone_scrypt_module = True
-		vmsg('Passwords (standalone scrypt):')
+		vmsg('Passwords (force standalone scrypt module):')
 		test_passwords()
-		vmsg('Hash presets (standalone scrypt):')
+		vmsg('Hash presets (force standalone scrypt module):')
 		test_presets((1,2,3))
 
 		if opt.quiet:

+ 5 - 3
test/unit_tests_d/ut_testdep.py

@@ -47,10 +47,12 @@ class unit_tests:
 		return True
 
 	def ethkey(self,name,ut):
-		if g.platform == 'linux':
+		if g.platform == 'linux' and os.uname().machine != 'x86_64':
 			distro = [l for l in open('/etc/os-release').read().split('\n') if l.startswith('ID=')][0][3:]
-			if distro not in ('arch','archarm'):
-				ymsg(f'Skipping ethkey availability test for distro {distro!r}')
+			if distro != 'archarm':
+				ymsg('Skipping ethkey availability test for distro {!r} on architecture {!r}'.format(
+					distro,
+					os.uname().machine ))
 				return True
 		from test.include.common import get_ethkey
 		get_ethkey()