Commit 286dda22 authored by Philip Carns's avatar Philip Carns
Browse files

Merge branch 'carns/issue-286-dxt-analyzer-error' into 'master'

validate input file format in dxt_analyzer

Closes #286

See merge request !84
parents 4f87238e e4d608dd
...@@ -80,6 +80,7 @@ import matplotlib ...@@ -80,6 +80,7 @@ import matplotlib
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import re import re
import argparse import argparse
import sys
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Regular expression and helper funtion definitions # Regular expression and helper funtion definitions
...@@ -258,6 +259,14 @@ if (args.singlefile_mode): ...@@ -258,6 +259,14 @@ if (args.singlefile_mode):
with open(dxt_logname) as infile: with open(dxt_logname) as infile:
try:
line = infile.readline()
if "# darshan" not in line:
raise Exception('Invalid file format')
except:
print("Error: unable to parse " + dxt_logname + ".", file=sys.stderr)
print(" Please make sure that it was generated by the darshan-dxt-parser utility.", file=sys.stderr)
sys.exit(1)
finfo_dict = {} finfo_dict = {}
curr_fname = '' curr_fname = ''
logdata = [] logdata = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment