Skip to content

Commit

Permalink
Update develop-ref after #2127 and #2130. (#2136)
Browse files Browse the repository at this point in the history
Co-authored-by: Julie Prestopnik <[email protected]>
Co-authored-by: johnhg <[email protected]>
Co-authored-by: Seth Linden <[email protected]>
Co-authored-by: John Halley Gotway <[email protected]>
Co-authored-by: j-opatz <[email protected]>
Co-authored-by: Howard Soh <[email protected]>
Co-authored-by: John Halley Gotway <[email protected]>
Co-authored-by: jprestop <[email protected]>
Co-authored-by: Howard Soh <[email protected]>
Co-authored-by: Randy Bullock <[email protected]>
Co-authored-by: davidfillmore <[email protected]>
Co-authored-by: rgbullock <[email protected]>
Co-authored-by: Seth Linden <[email protected]>
Co-authored-by: George McCabe <[email protected]>
Co-authored-by: Seth Linden <[email protected]>
Co-authored-by: hsoh-u <[email protected]>
Co-authored-by: John Halley Gotway <[email protected]>
Co-authored-by: MET Tools Test Account <[email protected]>
Co-authored-by: mo-mglover <[email protected]>
Co-authored-by: davidalbo <[email protected]>
Co-authored-by: lisagoodrich <[email protected]>
Co-authored-by: Dan Adriaansen <[email protected]>
  • Loading branch information
21 people authored Apr 9, 2022
1 parent fb3a092 commit b8d9aea
Show file tree
Hide file tree
Showing 15 changed files with 395 additions and 149 deletions.
36 changes: 19 additions & 17 deletions .github/jobs/set_job_controls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then

run_diff=true

# if base branch starts with main_v, use that input data
# if pull request into main_vX.Y branch,
# set truth data version to branch name and set input data version to X.Y
if [ "${GITHUB_BASE_REF:0:6}" == "main_v" ]; then
input_data_version=${GITHUB_BASE_REF:6}
truth_data_version=${GITHUB_BASE_REF}
input_data_version=${GITHUB_BASE_REF:6}
fi

fi
Expand All @@ -35,9 +37,9 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
run_diff=true
truth_data_version=${branch_name:0: -4}

# if branch starts with main_v, use that input data
# if main_vX.Y-ref branch, use X.Y input data
if [ "${branch_name:0:6}" == "main_v" ]; then
input_data_version=${branch_name:6:-4}
input_data_version=${branch_name:6: -4}
fi

else
Expand All @@ -46,10 +48,10 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
if [ "$branch_name" == "develop" ] ||
[ "${branch_name:0:6}" == "main_v" ]; then

run_diff=true
truth_data_version=${branch_name}
run_diff=true
truth_data_version=${branch_name}

# if branch starts with main_v, use that input data
# if main_vX.Y branch, use X.Y input data
if [ "${branch_name:0:6}" == "main_v" ]; then
input_data_version=${branch_name:6}
fi
Expand All @@ -59,34 +61,34 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
# check commit messages for skip or force keywords
if grep -q "ci-skip-all" <<< "$commit_msg"; then

run_compile=false
run_push=false
run_unit_tests=false
run_diff=false
run_update_truth=false
run_compile=false
run_push=false
run_unit_tests=false
run_diff=false
run_update_truth=false

fi

# check commit messages for ci-skip or ci-run keywords
if grep -q "ci-skip-compile" <<< "$commit_msg"; then

run_compile=false
run_compile=false

fi

if grep -q "ci-run-unit" <<< "$commit_msg"; then

run_diff=true
run_diff=true

fi

fi

elif [ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]; then

if [ "${force_tests}" == "true" ]; then
run_diff=true
fi
if [ "${force_tests}" == "true" ]; then
run_diff=true
fi

fi

Expand Down
3 changes: 3 additions & 0 deletions met/src/basic/vx_config/config_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ void parse_sid_mask(const ConcatString &mask_sid_str,

}

// Sort the mask_sid's
mask_sid.sort();

return;
}

Expand Down
193 changes: 117 additions & 76 deletions met/src/basic/vx_log/string_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ MaxLength = 0;

clear();

Sorted = false;

return;

}
Expand All @@ -149,6 +151,8 @@ void StringArray::clear()

s.clear();

Sorted = false;

return;

}
Expand All @@ -166,6 +170,7 @@ clear();
s = a.s;

IgnoreCase = a.IgnoreCase;
Sorted = a.Sorted;

return;

Expand All @@ -183,6 +188,7 @@ Indent prefix(depth);
Indent prefix2(depth + 1);

out << prefix << "IgnoreCase = " << IgnoreCase << "\n";
out << prefix << "Sorted = " << (Sorted ? "true" : "false") << "\n";

int j;

Expand Down Expand Up @@ -250,6 +256,8 @@ void StringArray::add(const std::string text)

s.push_back(text);

Sorted = false;

return;

}
Expand All @@ -265,7 +273,9 @@ void StringArray::add(const StringArray & a)
if ( a.n() == 0 ) return;

s.insert(s.end(), a.s.begin(), a.s.end());


Sorted = false;

return;

}
Expand Down Expand Up @@ -298,6 +308,8 @@ void StringArray::add_css(const std::string text)

}

Sorted = false;

return;

}
Expand All @@ -314,6 +326,9 @@ s.clear();

s.push_back(text);

// Setting to a single value, by nature it is Sorted
Sorted = true;

return;

}
Expand All @@ -336,6 +351,8 @@ void StringArray::set(int i, const std::string text)

s[i] = text;

Sorted = false;

return;

}
Expand All @@ -358,6 +375,8 @@ void StringArray::insert(int i, const char * text)

s.insert(s.begin()+i, text);

Sorted = false;

return;

}
Expand All @@ -366,90 +385,104 @@ void StringArray::insert(int i, const char * text)
////////////////////////////////////////////////////////////////////////


bool StringArray::has(const std::string text, bool forward) const
bool StringArray::has(const std::string text) const

{
bool found = false;
bool forward = true;

if (Sorted && !IgnoreCase) {
found = binary_search(s.begin(), s.end(), text);
}
else {
return ( has(text, forward) );
}

int index;
return found;
}

return ( has(text, index, forward) );

}
////////////////////////////////////////////////////////////////////////


bool StringArray::has(const std::string text, bool forward) const

{
int index;
return ( has(text, index, forward) );
}

////////////////////////////////////////////////////////////////////////


bool StringArray::has(const std::string text, int & index, bool forward) const

{
bool found = false;
index = -1;

if (!s.empty()) {
int count;
std::string lower_text = text;
std::vector<std::string>::const_iterator it;
if ( IgnoreCase ) transform(lower_text.begin(), lower_text.end(), lower_text.begin(), ::tolower);

if (forward) {
count = 0;
for(it = s.begin(); it != s.end(); it++, count++) {
if ( IgnoreCase ) {
std::string lower_s = *it;
transform(lower_s.begin(), lower_s.end(), lower_s.begin(), ::tolower);
if ( lower_s == lower_text) {
// if ( strcasecmp((*it).c_str(), text.c_str()) ) {
found = true;
break;
}
}
else {
if ( *it == text ) {
found = true;
break;
}
}
}
}
else {
count = s.size() - 1;
it = s.end();
for(it--; it != s.begin(); it--, count--) {
if ( IgnoreCase ) {
std::string lower_s = *it;
transform(lower_s.begin(), lower_s.end(), lower_s.begin(), ::tolower);
if ( lower_s == lower_text) {
found = true;
break;
}
}
else {
if ( *it == text ) {
found = true;
break;
}
}
// This function is now used for either an un-sorted array (Sorted is false)
// Or for a case-insensitive search (IgnoreCase is true)
//
bool found = false;
index = -1;

if (!s.empty()) {
int count;
std::string lower_text = text;
std::vector<std::string>::const_iterator it;
if ( IgnoreCase ) transform(lower_text.begin(), lower_text.end(), lower_text.begin(), ::tolower);

if (forward) {
count = 0;
for(it = s.begin(); it != s.end(); it++, count++) {
if ( IgnoreCase ) {
std::string lower_s = *it;
transform(lower_s.begin(), lower_s.end(), lower_s.begin(), ::tolower);
if ( lower_s == lower_text) {
found = true;
break;
}
}
else {
if ( *it == text ) {
found = true;
break;
}
}
}
}
if (!found && it == s.begin()) {
if ( IgnoreCase ) {
std::string lower_s = *it;
transform(lower_s.begin(), lower_s.end(), lower_s.begin(), ::tolower);
found = ( lower_s == lower_text );
}
else found = ( *it == text );
else {
count = s.size() - 1;
it = s.end();
for(it--; it != s.begin(); it--, count--) {
if ( IgnoreCase ) {
std::string lower_s = *it;
transform(lower_s.begin(), lower_s.end(), lower_s.begin(), ::tolower);
if ( lower_s == lower_text) {
found = true;
break;
}
}
else {
if ( *it == text ) {
found = true;
break;
}
}
}
if (!found && it == s.begin()) {
if ( IgnoreCase ) {
std::string lower_s = *it;
transform(lower_s.begin(), lower_s.end(), lower_s.begin(), ::tolower);
found = ( lower_s == lower_text );
}
else found = ( *it == text );
}
}
}
if (found) index = count;
}
//mlog << Debug(9) << " StringArray::has() size=" << s.size()
// << " for " << text << ", found: " << (found ? "true" : "false")
// << ", forward: " << (forward ? "yes" : "no") << "\n";

return found;

if (found) index = count;
}

return found;
}


////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -500,6 +533,8 @@ void StringArray::parse_delim(const std::string text, const char *delim)
if (start < str.length())
s.push_back(str.substr(start).c_str());

Sorted = false;

return;

}
Expand Down Expand Up @@ -616,13 +651,19 @@ return ( s[k].length() );
void StringArray::sort()

{

if ( n() <= 1 ) return;

std::sort(s.begin(), s.end());

return;

if ( n() <= 1 ) {
Sorted = true;
return;
}

if ( !Sorted ) {
std::sort(s.begin(), s.end());
}

Sorted = true;

return;

}


Expand Down
Loading

0 comments on commit b8d9aea

Please sign in to comment.