Recently, various automated testing approaches have been proposed that use specialized test oracles to find hundreds of logic bugs in mature, widely-used Database Management Systems (DBMSs). These test oracles require database and query generators, which must account for the often significant differences between the SQL dialects of these systems. Since it can take weeks to implement such generators, many DBMS developers are unlikely to invest the time to adopt such automated testing approaches. In short, existing approaches fail to scale to the plethora of DBMSs. In this work, we present both a vision and a platform, SQLancer++, to apply test oracles to any SQL-based DBMS that supports a subset of common SQL features. Our technical core contribution is a novel architecture for an adaptive SQL statement generator. This adaptive SQL generator generates SQL statements with various features, some of which might not be supported by the given DBMS, and then learns through interaction with the DBMS, which of these are understood by the DBMS. Thus, over time, the generator will generate mostly valid SQL statements. We evaluated SQLancer++ across 18 DBMSs and discovered a total of 196 unique, previously unknown bugs, of which 180 were fixed after we reported them. While SQLancer++ is the first major step towards scaling automated DBMS testing, various follow-up challenges remain.
翻译:近年来,多种自动化测试方法被提出,它们利用专门的测试预言器在成熟且广泛使用的数据库管理系统(DBMS)中发现了数百个逻辑错误。这些测试预言器需要数据库和查询生成器,而这些生成器必须考虑到这些系统之间SQL方言的显著差异。由于实现此类生成器可能需要数周时间,许多DBMS开发人员不太可能投入时间来采用这种自动化测试方法。简而言之,现有方法难以扩展到众多的DBMS。在本工作中,我们提出了一个愿景和一个平台——SQLancer++,旨在将测试预言器应用于任何支持常见SQL功能子集的基于SQL的DBMS。我们的核心技术贡献是一种新颖的自适应SQL语句生成器架构。该自适应SQL生成器生成具有各种功能的SQL语句,其中一些功能可能不被给定的DBMS支持,然后通过与DBMS的交互来学习哪些功能被DBMS理解。因此,随着时间的推移,生成器将主要生成有效的SQL语句。我们在18个DBMS上评估了SQLancer++,共发现了196个独特的、先前未知的错误,其中180个在我们报告后得到了修复。尽管SQLancer++是迈向扩展自动化DBMS测试规模的重要第一步,但仍存在各种后续挑战。