mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Added random test execution
This commit is contained in:
		
							parent
							
								
									e62f089a02
								
							
						
					
					
						commit
						ab3a1ec6ef
					
				@ -128,12 +128,4 @@ BOOST_AUTO_TEST_CASE(stPreCompiledContracts)
 | 
				
			|||||||
	dev::test::executeTests("stPreCompiledContracts", "/StateTests", dev::test::doStateTests);
 | 
						dev::test::executeTests("stPreCompiledContracts", "/StateTests", dev::test::doStateTests);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BOOST_AUTO_TEST_CASE(tmp)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int currentVerbosity = g_logVerbosity;
 | 
					 | 
				
			||||||
	g_logVerbosity = 12;
 | 
					 | 
				
			||||||
	dev::test::executeTests("tmp", "/StateTests", dev::test::doStateTests);
 | 
					 | 
				
			||||||
	g_logVerbosity = currentVerbosity;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
BOOST_AUTO_TEST_SUITE_END()
 | 
					BOOST_AUTO_TEST_SUITE_END()
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										36
									
								
								vm.cpp
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								vm.cpp
									
									
									
									
									
								
							@ -20,6 +20,7 @@
 | 
				
			|||||||
 * vm test functions.
 | 
					 * vm test functions.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <boost/filesystem.hpp>
 | 
				
			||||||
#include "vm.h"
 | 
					#include "vm.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
@ -423,6 +424,41 @@ BOOST_AUTO_TEST_CASE(vmPushDupSwapTest)
 | 
				
			|||||||
	dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests);
 | 
						dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOST_AUTO_TEST_CASE(vmRandom)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						string testPath = getTestPath();
 | 
				
			||||||
 | 
						testPath += "/VMTests/RandomTests";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						vector<boost::filesystem::path> testFiles;
 | 
				
			||||||
 | 
						boost::filesystem::directory_iterator iterator(testPath);
 | 
				
			||||||
 | 
						for(; iterator != boost::filesystem::directory_iterator(); ++iterator)
 | 
				
			||||||
 | 
							if (boost::filesystem::is_regular_file(iterator->path()) && iterator->path().extension() == ".json")
 | 
				
			||||||
 | 
								testFiles.push_back(iterator->path());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (auto& path: testFiles)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							try
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								cnote << "Testing ..." << path.filename();
 | 
				
			||||||
 | 
								json_spirit::mValue v;
 | 
				
			||||||
 | 
								string testpath(path.c_str());
 | 
				
			||||||
 | 
								string s = asString(dev::contents(testpath));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + testpath + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?");
 | 
				
			||||||
 | 
								json_spirit::read_string(s, v);
 | 
				
			||||||
 | 
								doVMTests(v, false);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							catch (Exception const& _e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							catch (std::exception const& _e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								BOOST_ERROR("Failed test with Exception: " << _e.what());
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BOOST_AUTO_TEST_CASE(userDefinedFile)
 | 
					BOOST_AUTO_TEST_CASE(userDefinedFile)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (boost::unit_test::framework::master_test_suite().argc == 2)
 | 
						if (boost::unit_test::framework::master_test_suite().argc == 2)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user