Skip to content
Snippets Groups Projects
Select Git revision
  • bugfix/debug_print
  • master default protected
  • bugfix/rank_setting
3 results

test_headers_in_ompi.pl

  • user avatar
    Ralph Castain authored
    869041f7
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test_headers_in_ompi.pl 4.88 KiB
    #!/usr/bin/perl
    #
    # Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
    #                         University Research and Technology
    #                         Corporation.  All rights reserved.
    # Copyright (c) 2004-2005 The University of Tennessee and The University
    #                         of Tennessee Research Foundation.  All rights
    #                         reserved.
    # Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
    #                         University of Stuttgart.  All rights reserved.
    # Copyright (c) 2004-2005 The Regents of the University of California.
    #                         All rights reserved.
    # $COPYRIGHT$
    #
    # Additional copyrights may follow
    #
    # $HEADER$
    #
    
    #this is the perl scripty foo which does the following tasks
    # 1. Extract the #include <*.h> files which are present in both header and source files
    # 2. Do some basic formatting
    # 3. Check if these included files are present on the platform which has been given
    
    if (scalar(@ARGV) != 2) {
        print "Usage:
               ./depend.pl <compiler-name>\n";
        exit(3);
    }
    
    $includes_file = "headers.txt";
    $return = &get_header_files($includes_file);
    
    $test_file = "test_headers.txt";
    $return = &parse_header_files($includes_file, $test_file);
    
    $source_tree = @ARGV[0];
    $CC = @ARGV[1];
    $result_file = "results.txt";
    $return = &test_for_headers($test_file, $result_file, $CC);
    
    # this file is used to extract which header files are included in a particular
    # source file. Kind of a neat implementation
    sub get_header_files {
    
        local($dump_file) = @_;
    
        open(C_FILES, "find $source_tree -name \*.c |") || print "could not find source files\n";
        open(H_FILES, "find $source_tree -name \*.c |") || print "could not find header files\n";
    
        open(DUMP, "> $dump_file") || print "Could not open $dump_file\n";
    
        while (<C_FILES>) {
            $file_h = $_;
            print DUMP "Processing $file_h";
            open(FILE_H, "$file_h") || print "could not open file for reading\n";
    
            #grep for the pattern which we want
            while (<FILE_H>) {
                if (/#include </) {
                    print DUMP $_, "\n";
                }
            }
            print DUMP "=============================================================================\n"
        }
    
        while (<H_FILES>) {
            $file_h = $_;
            print DUMP "Processing $file_h";
            open(FILE_H, "$file_h") || print "could not open file for reading\n";