Skip to content

specs-feup/cacti_tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CACTI Tests

This repository holds the C/C++ source files that represent various features of each language.

About CACTI

CACTI (Compiler Analysis, Comparison & Testing Infrastructure) is a project being developed by four software-engineering students, for the Capstone Project curricular unit.

As the name suggests, CACTI wishes to study and compare the capabilities of different compilers, by collecting/creating several input C and C++ files that represent various functionalities of each language, and by defining and implementing tests for each transpiliation task (parsing, code generation, querying and transformation).

Members

Students

  • Fábio Morais (202008052) - Faculty of Engineering, University of Porto, Portugal
  • Francisco Prada (202004646) - Faculty of Engineering, University of Porto, Portugal
  • Guilherme Sequeira (202004648) - Faculty of Engineering, University of Porto, Portugal
  • Pedro Ramalho (202004715) - Faculty of Engineering, University of Porto, Portugal

Tutors

  • João Bispo - Faculty of Engineering, University of Porto, Portugal
  • Luís Sousa - Faculty of Engineering, University of Porto, Portugal

Important scripts

Most of the scripts of this directory are inside the aux_scripts folder. They all support a "-h" flag for information on how to run them. Here is a compilation on how to run some of them:

Generate Report

Note: This tool was meant to be used strictly with the output of our CACTI tool.

$ python3 report.py [-h] -S SRC_PATH -T TRANSPILER
  • -S SRC_PATH - specify the path to the directory where the generated outputs are
  • -T TRANSPILER - the name of the transpiler which is to be tested

Generate the metadata

Note: You may use this tool on your own tests, as long as the directory of tests adheres to our convention:

  • The directory's direct descendents are all directories
  • The first nested directories' names are standard names
  • Inside those directories there aren't any other directories or files named after a standard
  • The last nested directory contains a src file with the correct suffix (e.g. .c for C files). A metadata.json file may also be present with additional information about the test, although its structure must also equal our conventions.
  • The last nested directory's name is the test's name (e.g. bool/ for a test that tests bools)
$ python3 metadata_gen.py [-h] -S SRC_PATH
  • -S SRC_PATH - specify the path to the directory where the tests currently are

Extract keywords

$ python3 extract_keywords.py <directory_path>
  • <directory_path> - define the directory to extract the keywords from

Extract the keywords from a single file

python3 extract_single_file_keywords.py <cpp_standard> <file_path>
  • <cpp_standard> - specify from which standard are the desired keywords
  • <file_path> - identify the path of the file from which the keywords should be extracted

Create graph with the generated nodes

$ python3 graph.py [-h] -S SRC_PATH [-c] [-l] [-v] [-O OUTPUT_PATH] [-F FORMAT]
  • -S SRC_PATH - path to the directory with the test files.
  • -c - print all the cycles found to standard output.
  • -l - print all the leaf nodes, that is, nodes with no dependencies.
  • -v - open a pop-up window that allows for a visual analysis of the graph.
  • -O OUTPUT_PATH - save an svg of the visual representation of the graph to a given directory.
  • -F FORMAT - Specify a file format to save the visual representation in. Must be supported by pyplot's savefig.

Sources

  • cppreference - the source files in this repository were adapted from the example code available here.